diff options
author | mcrane <mctch@yahoo.com> | 2009-08-01 04:29:33 -0600 |
---|---|---|
committer | mcrane <mctch@yahoo.com> | 2009-08-01 04:29:33 -0600 |
commit | e0660de17552d5a859b6215d1b8fa3132119bc8c (patch) | |
tree | 01cf49ef60b4dfdbd1c9d3c6af4fd0e7f97085e5 /config/denyhosts/denyhosts.inc | |
parent | 391e0bad90da42e64f244b979b83167b8acb744b (diff) | |
download | pfsense-packages-e0660de17552d5a859b6215d1b8fa3132119bc8c.tar.gz pfsense-packages-e0660de17552d5a859b6215d1b8fa3132119bc8c.tar.bz2 pfsense-packages-e0660de17552d5a859b6215d1b8fa3132119bc8c.zip |
DenyHosts syntax improvements, editarea loaded if not available
Diffstat (limited to 'config/denyhosts/denyhosts.inc')
-rw-r--r-- | config/denyhosts/denyhosts.inc | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/config/denyhosts/denyhosts.inc b/config/denyhosts/denyhosts.inc index d83f2878..1efb250a 100644 --- a/config/denyhosts/denyhosts.inc +++ b/config/denyhosts/denyhosts.inc @@ -60,11 +60,19 @@ function php_install_command() exec("pkg_delete denyhosts"); + //misc files + if (!is_dir('/usr/local/www/edit_area/')) { + chdir('/tmp/'); + exec("cd /tmp/;fetch ".$download_path."edit_area.tgz"); + chdir('/usr/local/www'); + system('tar xvpfz /tmp/edit_area.tgz edit_area'); + unlink_if_exists("/tmp/edit_area.tgz"); + } $hosts_allow = "#\n"; $hosts_allow .= "# hosts.allow access control file for \"tcp wrapped\" applications.\n"; - $hosts_allow .= "#\n; + $hosts_allow .= "#\n"; $hosts_allow .= "sshd : /etc/hosts.deniedssh : deny\n"; $hosts_allow .= "sshd : ALL : allow\n"; $hosts_allow .= "ALL : ALL : allow\n"; @@ -73,8 +81,14 @@ function php_install_command() unset($hosts_allow); fclose($fout); - exec("touch /etc/hosts.deniedssh"); - exec("chmod 755 /etc/hosts.deniedssh"); + if(!is_file("/etc/hosts.deniedssh")) { + exec("touch /etc/hosts.deniedssh"); + exec("chmod 755 /etc/hosts.deniedssh"); + } + + if(!is_file("/var/log/denyhosts")) { + exec ('touch /var/log/denyhosts'); + } $download_path = 'http://www.pfsense.com/packages/config/denyhosts/'; @@ -104,7 +118,7 @@ function php_install_command() unset($denyhosts_sh); fclose($fout); - + $filename = "/usr/local/etc/denyhosts.conf"; $handle = fopen($filename,"rb"); $denyhosts_conf = fread($handle, filesize($filename)); @@ -117,6 +131,7 @@ function php_install_command() unset($filename); fclose($fout); + $filename = "/usr/local/etc/denyhosts.conf-dist"; $fout = fopen($filename,"w"); fwrite($fout, $denyhosts_conf); @@ -124,6 +139,7 @@ function php_install_command() unset($denyhosts_conf); fclose($fout); + //Error reading file: denyhosts.cfg //write_rcfile(array( // "file" => "denyhosts.sh", @@ -135,9 +151,11 @@ function php_install_command() php_sync_package(); + //start denyhosts exec("/usr/local/etc/rc.d/denyhosts.sh start"); + //if (pkg_is_service_running('notes')) { //documentation purposes //} @@ -152,7 +170,7 @@ function deinstall_command() $hosts_allow = "#\n"; $hosts_allow .= "# hosts.allow access control file for \"tcp wrapped\" applications.\n"; - $hosts_allow .= "#\n; + $hosts_allow .= "#\n"; $hosts_allow .= "ALL : ALL : allow\n"; $fout = fopen("/etc/hosts.allow","w"); fwrite($fout, $tmp); |