mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
If any of the /etc/ssh/ files are corrupted then remove them so they will be forced to regenerate.
This commit is contained in:
parent
850b71ec84
commit
746b5ee2e2
17
etc/sshd
17
etc/sshd
@ -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");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user