diff --git a/authserv/server.py b/authserv/server.py index 3e82c67f31dd22c08429cff5126bc8c62f007162..7853fe7de0b7598e63365a6be467dea93a717183 100644 --- a/authserv/server.py +++ b/authserv/server.py @@ -81,23 +81,26 @@ def main(sysargs=None): parser.add_option('--dhparams', dest='dh_params', default='/etc/ai/dhparams', help='Diffie-Helmann parameters file') + parser.add_option('--syslog', action='store_true') parser.add_option('--debug', action='store_true') opts, args = parser.parse_args(sysargs) if len(args) != 0: parser.error('Too many arguments') - if opts.debug: - logging.basicConfig(level=logging.DEBUG) - else: + loglevel = logging.DEBUG if opts.debug else logging.INFO + if opts.syslog: handler = logging.handlers.SysLogHandler( address='/dev/log', facility=logging.handlers.SysLogHandler.LOG_DAEMON) handler.setFormatter( logging.Formatter('auth_server: %(message)s')) for l in (logging.getLogger(), app_main.app.logger, app_nginx.app.logger): - l.setLevel(logging.INFO) + l.setLevel(loglevel) l.addHandler(handler) + else: + logging.basicConfig(level=loglevel, + format='%(levelname)s: %(message)s') if opts.config: os.environ['APP_CONFIG'] = opts.config diff --git a/debian/ai-auth-server.service b/debian/ai-auth-server.service new file mode 100644 index 0000000000000000000000000000000000000000..15b51220ec0e261a5cc5bc84a1c17b35d017ff03 --- /dev/null +++ b/debian/ai-auth-server.service @@ -0,0 +1,19 @@ +[Unit] +Description=A/I authentication server +After=network.target + +[Service] +User=ai-auth-server +Environment=CONFIG=/etc/ai-auth-server.conf +Environment=BIND_ADDR=127.0.0.1 +Environment=PORT=1616 +EnvironmentFile=-/etc/default/ai-auth-server +ExecStart=/usr/bin/ai-auth-server \ + --config=$CONFIG \ + --port=$PORT \ + --addr=$BIND_ADDR \ + $DAEMON_ARGS +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/debian/changelog b/debian/changelog index a325f5c44d2a6985aa2b9269b35ebb9a6cbe0187..79b1ec5488e4f2d06de25c247401c7cf565095fe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +authserv (0.1.1) unstable; urgency=medium + + * Systemd support. + + -- Autistici/Inventati <debian@autistici.org> Mon, 17 Oct 2016 07:29:45 +0100 + authserv (0.1) unstable; urgency=low * Initial Release. diff --git a/debian/control b/debian/control index 15aae4f4706b995dabca711f3b7bda1bad1ce41b..20e223e42c02b3826487072d3b8a4e52af471e1a 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Priority: extra Maintainer: Autistici/Inventati <debian@autistici.org> Build-Depends: debhelper (>= 8.0.0), build-essential, python (>= 2.6.6-3~), python-setuptools, autoconf, automake, libtool, - libcurl4-openssl-dev, libpam0g-dev + libcurl4-openssl-dev, libpam0g-dev, dh-python, dh-systemd Standards-Version: 3.9.4 Package: libpam-authclient diff --git a/setup.py b/setup.py index 3877e0b7f7b4d4fe87102353630ea4962c64a6ae..ce13fc5c57bb8bdfbc5669f69062c2360c327d11 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup, find_packages setup( name="authserv", - version="0.1", + version="0.1.1", description="Authentication server", author="Autistici/Inventati", author_email="info@autistici.org",