Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packaging/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
denyhosts-server (2.0.0-1) trusty; urgency=medium

* Initial Release.

-- Sergey Dryabzhinsky <sergey.dryabzhinsky@gmail.com> Sun, 10 Jan 2016 01:17:46 +0300
1 change: 1 addition & 0 deletions packaging/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7
20 changes: 20 additions & 0 deletions packaging/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Source: denyhosts-server
Section: net
Priority: optional
Maintainer: Jan-Pascal van Best <janpascal@vanbest.org>
Uploaders: Sergey Dryabzhinsky <sergey.dryabzhinsky@gmail.com>
Build-Depends: debhelper (>= 7.0.50~), python (>= 2.6.6-3~), dh-python | debhelper (>= 8), python-minify | python2.7-pip-minify | python2.6-pip-minify
Standards-Version: 3.9.3
Homepage: https://github.com/janpascal/denyhosts_sync.git

Package: denyhosts-server
Architecture: all
Depends: lsb-base (>= 3.1-13), ${python:Depends}, ${misc:Depends},
python-twisted, python-ipaddr, python-jinja2, python-numpy, python-geoip,
python-matplotlib, python-twistar | python2.7-pip-twistar | python2.6-pip-twistar
Recommends: nginx | nginx-light | nginx-hosting | nginx-full
Description: denyhosts-server is a server for denyhosts clients
denyhosts-server is a server that allows denyhosts clients to share
blocked IP addresses. It is intended to be a drop-in replacement for
the service at xmlrpc.denyhosts.net that up to now has been provided
by the original author of denyhosts.
40 changes: 40 additions & 0 deletions packaging/debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: DenyHosts-Server
Upstream-Contact: Jan-Pascal van Best <janpascal@vanbest.org>
Source: https://github.com/janpascal/denyhosts_sync

Files: *
Copyright: 2005-2006, Phil Schwartz <phil_schwartz@users.sourceforge.net>
2014-2015, Jesse Smith <slicer69@hotmail.com>
2012, 2014-2015, Matt Ruffalo <matthew.ruffalo@case.edu>
License: GPL-2+
2015, Jan-Pascal van Best janpascal@vanbest.org
License: GPL-3

Files: debian/*
Copyright: 2006, Marco Bertorello <marco@bertorello.ns0.it>
2011, Kyle Willmon <kylewillmon@gmail.com>
License: GPL-2+
2015, Sergey Dryabzhinsky <sergey.dryabzhinsky@gmail.com>
License: GPL-3

License: GPL-2+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this package; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301, USA.
.
On Debian systems, the complete text of the GNU General Public
License, version 2, can be found in '/usr/share/common-licenses/GPL-2'.
.
On Debian systems, the complete text of the GNU General Public
License, version 3, can be found in '/usr/share/common-licenses/GPL-3'.
3 changes: 3 additions & 0 deletions packaging/debian/denyhosts-server.dirs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/var/lib/denyhosts-server/static/graph
/var/www/sites/denyhosts-server
/var/log/denyhosts-server
75 changes: 75 additions & 0 deletions packaging/debian/denyhosts-server.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#! /bin/sh
#
### BEGIN INIT INFO
# Provides: denyhosts-server
# Required-Start: $syslog $network $remote_fs
# Required-Stop: $syslog $network $remote_fs
# Should-Start: mysql
# Should-Stop: mysql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: DenyHosts synchronisation service
# Description: Service that allows DenyHosts clients to share blocked IP
# addresses.
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/denyhosts-server
DESC="DenyHosts sync server"
NAME=`basename $DAEMON`
PIDFILE=/var/run/$NAME.pid
DAEMONUSER=denyhosts-server
DAEMONGROUP=denyhosts
WORKDIR=/var/lib/denyhosts-server
CONFIG_FILE=/etc/denyhosts-server.conf
QUIET=--quiet

test -x $DAEMON || exit 0

# Include defaults if available
if [ -f /etc/default/denyhosts-server ] ; then
. /etc/default/denyhosts-server
fi
DAEMON_ARGS="-c $CONFIG_FILE"

#set -e

. /lib/lsb/init-functions

case "$1" in
start)
log_begin_msg "Starting $DESC: $NAME"
start-stop-daemon --start $QUIET --chuid $DAEMONUSER:$DAEMONGROUP \
--chdir $WORKDIR \
--make-pidfile --pidfile $PIDFILE --background \
--startas $DAEMON -- $DAEMON_ARGS
log_end_msg $?
;;
stop)
log_begin_msg "Stopping $DESC: $NAME"
start-stop-daemon --stop $QUIET --retry=TERM/30/KILL/5 --chuid $DAEMONUSER:$DAEMONGROUP \
--chdir $WORKDIR \
--pidfile $PIDFILE \
--startas $DAEMON -- $DAEMON_ARGS
log_end_msg $?
;;
restart)
$0 stop
$0 start
;;
status)
status_of_proc "$DAEMON" $NAME
;;
reload|force-reload)
log_begin_msg "Reloading $DESC: $NAME"
start-stop-daemon --stop --signal HUP --pidfile $PIDFILE
log_end_msg $?
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac

exit 0
4 changes: 4 additions & 0 deletions packaging/debian/denyhosts-server.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
static/css/*.min.* /var/lib/denyhosts-server/static/css
static/js/*.min.* /var/lib/denyhosts-server/static/js
template /var/lib/denyhosts-server/
debian/etc/* etc/
1 change: 1 addition & 0 deletions packaging/debian/denyhosts-server.links
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/var/lib/denyhosts-server/static /var/www/sites/denyhosts-server/static
16 changes: 16 additions & 0 deletions packaging/debian/denyhosts-server.logrotate
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/var/log/denyhosts-server/*.log {
create 0640 denyhosts adm
missingok
daily
rotate 32
compress
delaycompress
notifempty
postrotate
if [ -x /usr/sbin/invoke-rc.d ]; then \
invoke-rc.d denyhosts-server reload > /dev/null; \
else \
/etc/init.d/denyhosts-server reload > /dev/null; \
fi
endscript
}
1 change: 1 addition & 0 deletions packaging/debian/denyhosts-server.manpages
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
denyhosts-server.1
55 changes: 55 additions & 0 deletions packaging/debian/denyhosts-server.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/sh

set -e

CNF=/etc/denyhosts-server.conf
WD=/var/lib/denyhosts-server
# denyhosts-server user
DSU=denyhosts-server
DSG=denyhosts
DAEMON=/usr/sbin/denyhosts-server

case "$1" in
configure)
if [ -z "$2" ]; then
echo ""
echo "Add user $DSU if not exists."

addgroup --system $DSG || true
adduser --system --no-create-home --home $WD \
--ingroup $DSG --disabled-password --disabled-login --gecos /dev/null $DSU || true
usermod -aG www-data $DSU || true
# For init/upgrade db
usermod -s /bin/sh $DSU || true

chown -R $DSU:$DSG /var/log/denyhosts-server
chown -R $DSU:www-data /var/lib/denyhosts-server
chown -R $DSU:www-data /var/www/sites/denyhosts-server

echo ""
service denyhosts-server stop || true
echo "Init denyhosts-server database."
su -c "cd $WD; $DAEMON -c $CNF --recreate-database --force" - $DSU
echo ""
else
echo ""
echo "Upgrade denyhosts-server database."
service denyhosts-server stop || true
su -c "cd $WD; $DAEMON -c $CNF --evolve-database --force" - $DSU
echo ""
fi
service nginx reload || true
;;

abort-upgrade|abort-remove|abort-deconfigure)
;;

*)
echo "postinst called with unknown argument '$1'" >&2
exit 1
;;
esac

#DEBHELPER#

exit 0
27 changes: 27 additions & 0 deletions packaging/debian/denyhosts-server.postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
# postrm script for denyhosts

set -e

case "$1" in
purge)
rm -fr /var/log/denyhosts-server
rm -fr /var/lib/denyhosts-server
deluser denyhosts-server || true
deluser --group --only-if-empty denyhosts || true
service nginx reload || true
rm -rf /var/www/sites/denyhosts-server
;;

remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;

*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1

esac

#DEBHELPER#

exit 0
18 changes: 18 additions & 0 deletions packaging/debian/denyhosts-server.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Unit]
Description=DenyHosts synchronisation service
After=syslog.target

[Service]
Type=simple
User=denyhosts-server
Group=denyhosts
EnvironmentFile=-/etc/default/denyhosts-server
WorkingDirectory=/var/lib/denyhosts-server
ExecStart=/usr/sbin/denyhosts-server -c /etc/denyhosts-server.conf
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
StandardOutput=syslog
StandardError=syslog

[Install]
WantedBy=multi-user.target
41 changes: 41 additions & 0 deletions packaging/debian/denyhosts-server.upstart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
author "Sergey Dryabzhinsky <sergey.dryabzhinsky@gmail.com>"
description "Handles starting of DenyHosts Sync on server reboot, or in the event of an error"

env NAME=denyhosts-server
env NAME2="DenyHosts sync server"
env DAEMON="/usr/sbin/denyhosts-server"
env CONFIG="/etc/denyhosts-server.conf"
env PIDFILE="/var/run/denyhosts-server.pid"
env DAEMONUSER=denyhosts-server
env DAEMONGROUP=denyhosts
env WORKDIR=/var/lib/denyhosts-server

start on runlevel [2345]
stop on runlevel [016]

expect daemon

respawn
respawn limit 10 5

exec start-stop-daemon --start --chuid $DAEMONUSER:$DAEMONGROUP \
--chdir $WORKDIR \
--make-pidfile --pidfile $PIDFILE --background \
--startas $DAEMON -- -c $CONFIG

pre-start script
if [ -f $PIDFILE ]; then
pid=$(cat $PIDFILE)
if kill -0 "$pid" > /dev/null; then
start-stop-daemon --stop --quiet --retry 5 --pidfile $PIDFILE
echo "Restarting $NAME2" | logger -t "$NAME"
else
echo "$NAME2 started" | logger -t "$NAME"
fi
rm -f $PIDFILE
fi
end script

pre-stop script
echo "$NAME2 stopped" | logger -t "$NAME"
end script
6 changes: 6 additions & 0 deletions packaging/debian/docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
LICENSE.md
README.md
changelog.txt
denyhosts-server.conf.example
denyhosts-server.init.example
denyhosts-server.service.example
Loading