diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-07-17 19:43:11 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-07-17 19:43:11 +0000 |
commit | 746b5ee2e2eb941d39bba1f8f78498e8fcb518cb (patch) | |
tree | e303cdb06ed6ec9dd049db1da7beba8ce131fb4a | |
parent | 850b71ec84084c60dbfcbea8f2d1668486eabf28 (diff) | |
download | pfsense-746b5ee2e2eb941d39bba1f8f78498e8fcb518cb.zip pfsense-746b5ee2e2eb941d39bba1f8f78498e8fcb518cb.tar.gz |
If any of the /etc/ssh/ files are corrupted then remove them so they will be forced to regenerate.
-rwxr-xr-x | etc/sshd | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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"); |