summaryrefslogtreecommitdiff
path: root/app-admin/denyhosts/files
diff options
context:
space:
mode:
Diffstat (limited to 'app-admin/denyhosts/files')
-rw-r--r--app-admin/denyhosts/files/denyhosts-2.6-hostname.patch21
-rw-r--r--app-admin/denyhosts/files/denyhosts-3.0-python2.7.patch51
-rw-r--r--app-admin/denyhosts/files/denyhosts.init-r227
-rw-r--r--app-admin/denyhosts/files/denyhosts.logrotate-r210
-rw-r--r--app-admin/denyhosts/files/denyhosts.service12
5 files changed, 121 insertions, 0 deletions
diff --git a/app-admin/denyhosts/files/denyhosts-2.6-hostname.patch b/app-admin/denyhosts/files/denyhosts-2.6-hostname.patch
new file mode 100644
index 000000000000..56d881319c5f
--- /dev/null
+++ b/app-admin/denyhosts/files/denyhosts-2.6-hostname.patch
@@ -0,0 +1,21 @@
+diff -up ./denyhosts.py.orig ./denyhosts.py
+--- ./denyhosts.py.orig 2012-01-30 13:14:41.146715839 -0600
++++ ./denyhosts.py 2012-01-30 14:45:14.372539341 -0600
+@@ -1,5 +1,6 @@
+ #!/usr/bin/env python
+ import os
++import platform
+ import sys
+
+ import DenyHosts.python_version
+@@ -107,6 +108,10 @@ if __name__ == '__main__':
+ print "DenyHosts version:", VERSION
+ sys.exit(0)
+
++ # This is generally expected to be in the environment, but there's no
++ # non-hackish way to get systemd to set it, so just hack it in here.
++ os.environ['HOSTNAME'] = platform.node()
++
+ prefs = Prefs(config_file)
+
+ first_time = 0
diff --git a/app-admin/denyhosts/files/denyhosts-3.0-python2.7.patch b/app-admin/denyhosts/files/denyhosts-3.0-python2.7.patch
new file mode 100644
index 000000000000..4b727c7067d9
--- /dev/null
+++ b/app-admin/denyhosts/files/denyhosts-3.0-python2.7.patch
@@ -0,0 +1,51 @@
+From b5611dfa0510ec8fbaa2db4b6834d0bd7ecf0909 Mon Sep 17 00:00:00 2001
+From: Jesse <jessefrgsmith@yahoo.ca>
+Date: Sat, 27 Jun 2015 20:24:44 -0300
+Subject: [PATCH] Fixed a type check which was causing syntax/undefined errors
+ in DenyHosts/report.py when switching between Python2 and Python3.
+
+---
+ CHANGELOG.txt | 8 ++++++++
+ DenyHosts/report.py | 4 +++-
+ 2 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/CHANGELOG.txt b/CHANGELOG.txt
+index ca173cb..b585332 100644
+--- a/CHANGELOG.txt
++++ b/CHANGELOG.txt
+@@ -1,5 +1,13 @@
+ DENYHOSTS CHANGELOG
+
++3.1
++======================
++
++Fixed a type check in DenyHosts/report.py which was causing
++problems when moving between Python2 and Python3.
++
++
++
+ 3.0
+ ======================
+
+diff --git a/DenyHosts/report.py b/DenyHosts/report.py
+index 05f3e3d..9560eab 100644
+--- a/DenyHosts/report.py
++++ b/DenyHosts/report.py
+@@ -3,6 +3,7 @@
+ import socket
+ # Removing this as it causes runtime errors on Python3.4
+ # from types import ListType, TupleType
++import types
+ from .util import is_true
+ try:
+ import syslog
+@@ -38,7 +39,8 @@ def get_report(self):
+ def add_section(self, message, iterable):
+ self.report += "%s:\n\n" % message
+ for i in iterable:
+- if type(i) in (TupleType, ListType):
++ # if type(i) in (TupleType, ListType):
++ if (type(i) is types.ListType) or (type(i) is types.TupleType):
+ extra = ": %d\n" % i[1]
+ i = i[0]
+ else:
diff --git a/app-admin/denyhosts/files/denyhosts.init-r2 b/app-admin/denyhosts/files/denyhosts.init-r2
new file mode 100644
index 000000000000..9b2f24cbf21e
--- /dev/null
+++ b/app-admin/denyhosts/files/denyhosts.init-r2
@@ -0,0 +1,27 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_stopped_commands="purge"
+
+purge() {
+ ebegin "Purging hosts.deny"
+ start-stop-daemon --start --exec /usr/bin/denyhosts.py --pidfile /var/run/denyhosts.pid -- --purge
+ eend $?
+}
+
+depend() {
+ use logger sshd
+}
+
+start() {
+ ebegin "Starting DenyHosts daemon"
+ start-stop-daemon --start --exec /usr/bin/denyhosts.py --pidfile /var/run/denyhosts.pid -- --daemon -c /etc/denyhosts.conf
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping DenyHosts daemon"
+ start-stop-daemon --quiet --stop --pidfile /var/run/denyhosts.pid
+ eend $?
+}
diff --git a/app-admin/denyhosts/files/denyhosts.logrotate-r2 b/app-admin/denyhosts/files/denyhosts.logrotate-r2
new file mode 100644
index 000000000000..582e72f7a365
--- /dev/null
+++ b/app-admin/denyhosts/files/denyhosts.logrotate-r2
@@ -0,0 +1,10 @@
+/var/log/denyhosts {
+ missingok
+ notifempty
+ create 0640 root root
+ sharedscripts
+ postrotate
+ test -e /run/openrc/softlevel && /etc/init.d/denyhosts restart 1>/dev/null || true
+ test -e /run/systemd/system && systemctl restart denyhosts >/dev/null || true
+ endscript
+}
diff --git a/app-admin/denyhosts/files/denyhosts.service b/app-admin/denyhosts/files/denyhosts.service
new file mode 100644
index 000000000000..05a59dd27bfc
--- /dev/null
+++ b/app-admin/denyhosts/files/denyhosts.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=SSH log watcher
+Before=sshd.service
+
+[Service]
+Type=forking
+ExecStartPre=/bin/rm -f /var/run/denyhosts.pid
+ExecStart=/usr/bin/denyhosts.py --daemon --config=/etc/denyhosts.conf
+PIDFile=/var/run/denyhosts.pid
+
+[Install]
+WantedBy=multi-user.target