If any of the /etc/ssh/ files are corrupted then remove them so they will be forced to regenerate.

This commit is contained in:
Scott Ullrich 2005-07-17 19:43:11 +00:00
parent 850b71ec84
commit 746b5ee2e2

View File

@ -32,6 +32,23 @@
$stderr = fopen("php://stderr", "w");
function file_size($file) {
$size = filesize($file);
if ( $size == 0)
$size = exec("ls -l $file | awk '{print $5}'");
return $size;
}
/* if any of these files are 0 bytes then they are corrupted.
* remove them
*/
$files_to_check = array('ssh_host_dsa_key','ssh_host_dsa_key.pub','ssh_host_key','ssh_host_key.pub','ssh_host_rsa_key','ssh_host_rsa_key.pub');
foreach($files_to_check as $f2c) {
if(file_size($f2c)==0) {
mwexec("rm /etc/ssh_host*");
}
}
if($argv[1] == "stop" || $argv[0] == "stop") {
if(file_exists("/root/.authorized_keys")) {
$ak = return_filename_as_string("/root/.authorized_keys");