aboutsummaryrefslogtreecommitdiffstats
path: root/config/denyhosts
diff options
context:
space:
mode:
authormcrane <mctch@yahoo.com>2009-08-01 04:29:33 -0600
committermcrane <mctch@yahoo.com>2009-08-01 04:29:33 -0600
commite0660de17552d5a859b6215d1b8fa3132119bc8c (patch)
tree01cf49ef60b4dfdbd1c9d3c6af4fd0e7f97085e5 /config/denyhosts
parent391e0bad90da42e64f244b979b83167b8acb744b (diff)
downloadpfsense-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')
-rw-r--r--config/denyhosts/denyhosts.inc28
-rw-r--r--config/denyhosts/denyhosts.xml4
-rw-r--r--config/denyhosts/denyhosts_log.tmp29
3 files changed, 45 insertions, 16 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);
diff --git a/config/denyhosts/denyhosts.xml b/config/denyhosts/denyhosts.xml
index 35878c7a..5a09be94 100644
--- a/config/denyhosts/denyhosts.xml
+++ b/config/denyhosts/denyhosts.xml
@@ -7,7 +7,7 @@
/* $Id$ */
/* ========================================================================== */
/*
- notes.xml
+ denyhosts.xml
Copyright (C) 2008 Mark J Crane
All rights reserved.
*/
@@ -41,7 +41,7 @@
<requirements>Describe your package requirements here</requirements>
<faq>Currently there are no FAQ items provided.</faq>
<name>DenyHosts</name>
- <version>0.1</version>
+ <version>0.2</version>
<title>Settings</title>
<include_file>/usr/local/pkg/denyhosts.inc</include_file>
<menu>
diff --git a/config/denyhosts/denyhosts_log.tmp b/config/denyhosts/denyhosts_log.tmp
index 69d16cce..a56e4eab 100644
--- a/config/denyhosts/denyhosts_log.tmp
+++ b/config/denyhosts/denyhosts_log.tmp
@@ -51,9 +51,18 @@ if ($_POST['a'] == "save") {
}
*/
+if(!is_file("/var/log/denyhosts")) {
+ exec ('touch /var/log/denyhosts');
+}
+
$filename = '/var/log/denyhosts';
$fd = fopen($filename, "r");
-$content = fread($fd, filesize($filename));
+if (filesize($filename) > 0) {
+ $content = fread($fd, filesize($filename));
+}
+else {
+ $content = '';
+}
fclose($fd);
include("head.inc");
@@ -83,7 +92,7 @@ function sf() { document.forms[0].savetopath.focus(); }
<?php
include("fbegin.inc");
-echo "<p class=\"pgtitle\">$v_project_label: Variables</p>\n";
+echo "<p class=\"pgtitle\">Deny Hosts</p>\n";
?>
<div id="mainlevel">
@@ -107,36 +116,38 @@ echo "<p class=\"pgtitle\">$v_project_label: Variables</p>\n";
<?php
?>
+ <!--
<table width="98%" border="0" cellpadding="6" cellspacing="0">
<tr>
- <td width='90%'><p><span class="vexpl"><span class="red"><strong>DenyHosts Log<br>
+ <td width='90%'><p><span class="vexpl"><span class="red"><strong>zzz<br>
</strong></span>
- <!-- Description -->
+ Description
</p>
</td>
- <td width='10%' align='right' valign='middle'><!--<input type="submit" value="save" />--></td>
+ <td width='10%' align='right' valign='middle'><input type="submit" value="save" /></td>
</tr>
</table>
+ -->
<br />
<br />
<textarea style="width:98%" id="code" name="code" rows="30" cols="<?php echo $cols; ?>" name="content"><?php echo htmlentities($content); ?></textarea>
<br />
<br />
- <!--
+
<table width="98%" border="0" cellpadding="6" cellspacing="0">
<tr>
- <td>/usr/local/zzz/conf/zzz.xml</td>
+ <td>/var/log/denyhosts</td>
<td align='right'>
<input type="hidden" name="f" value="<?php echo $_GET['f']; ?>" />
<input type="hidden" name="a" value="save" />
<?php
- echo "<input type='button' value='Restore Default' onclick=\"document.location.href='/packages/zzz/zzz.php?a=default&f=zzz';\" />";
+ //echo "<input type='button' value='Restore Default' onclick=\"document.location.href='/packages/zzz/zzz.php?a=default&f=zzz';\" />";
?>
</td>
</tr>
</table>
- -->
+
<!--
</form>
-->