Skip to content
Snippets Groups Projects
Commit bbfe0975 authored by ale's avatar ale
Browse files

systemd support

parent 3910abfd
No related branches found
No related tags found
No related merge requests found
...@@ -81,23 +81,26 @@ def main(sysargs=None): ...@@ -81,23 +81,26 @@ def main(sysargs=None):
parser.add_option('--dhparams', dest='dh_params', parser.add_option('--dhparams', dest='dh_params',
default='/etc/ai/dhparams', default='/etc/ai/dhparams',
help='Diffie-Helmann parameters file') help='Diffie-Helmann parameters file')
parser.add_option('--syslog', action='store_true')
parser.add_option('--debug', action='store_true') parser.add_option('--debug', action='store_true')
opts, args = parser.parse_args(sysargs) opts, args = parser.parse_args(sysargs)
if len(args) != 0: if len(args) != 0:
parser.error('Too many arguments') parser.error('Too many arguments')
if opts.debug: loglevel = logging.DEBUG if opts.debug else logging.INFO
logging.basicConfig(level=logging.DEBUG) if opts.syslog:
else:
handler = logging.handlers.SysLogHandler( handler = logging.handlers.SysLogHandler(
address='/dev/log', address='/dev/log',
facility=logging.handlers.SysLogHandler.LOG_DAEMON) facility=logging.handlers.SysLogHandler.LOG_DAEMON)
handler.setFormatter( handler.setFormatter(
logging.Formatter('auth_server: %(message)s')) logging.Formatter('auth_server: %(message)s'))
for l in (logging.getLogger(), app_main.app.logger, app_nginx.app.logger): for l in (logging.getLogger(), app_main.app.logger, app_nginx.app.logger):
l.setLevel(logging.INFO) l.setLevel(loglevel)
l.addHandler(handler) l.addHandler(handler)
else:
logging.basicConfig(level=loglevel,
format='%(levelname)s: %(message)s')
if opts.config: if opts.config:
os.environ['APP_CONFIG'] = opts.config os.environ['APP_CONFIG'] = opts.config
......
[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
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 authserv (0.1) unstable; urgency=low
* Initial Release. * Initial Release.
......
...@@ -4,7 +4,7 @@ Priority: extra ...@@ -4,7 +4,7 @@ Priority: extra
Maintainer: Autistici/Inventati <debian@autistici.org> Maintainer: Autistici/Inventati <debian@autistici.org>
Build-Depends: debhelper (>= 8.0.0), build-essential, Build-Depends: debhelper (>= 8.0.0), build-essential,
python (>= 2.6.6-3~), python-setuptools, autoconf, automake, libtool, 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 Standards-Version: 3.9.4
Package: libpam-authclient Package: libpam-authclient
......
...@@ -4,7 +4,7 @@ from setuptools import setup, find_packages ...@@ -4,7 +4,7 @@ from setuptools import setup, find_packages
setup( setup(
name="authserv", name="authserv",
version="0.1", version="0.1.1",
description="Authentication server", description="Authentication server",
author="Autistici/Inventati", author="Autistici/Inventati",
author_email="info@autistici.org", author_email="info@autistici.org",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment