The branch, master has been updated via 167b8152ce5403b169a55573d72c43880967b8b6 (commit) from 538a0e8003c67a29f6fcd179909fbcf0e648da15 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 167b8152ce5403b169a55573d72c43880967b8b6 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Thu Dec 19 22:23:17 2013 +0100 Support daemonizing of the authservice. ----------------------------------------------------------------------- Summary of changes: debian/changelog | 1 + sbin/x2gobroker-authservice | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) The diff of changes is: diff --git a/debian/changelog b/debian/changelog index 1fe4749..adaa778 100644 --- a/debian/changelog +++ b/debian/changelog @@ -68,6 +68,7 @@ x2gobroker (0.0.3.0-0x2go1) UNRELEASED; urgency=low an sbin to a bin directory (executable for any user). - Make the inifile broker backend the default backend. - Support daemonizing of the http broker. + - Support daemonizing of the authservice. * debian/control: + Replace LDAP support with session brokerage support in LONG_DESCRIPTION. + Fix SYNOPSIS texts. diff --git a/sbin/x2gobroker-authservice b/sbin/x2gobroker-authservice index d45c84c..7f3c113 100755 --- a/sbin/x2gobroker-authservice +++ b/sbin/x2gobroker-authservice @@ -32,6 +32,17 @@ import getpass import logging.config import pam +try: + import daemonize + CAN_DAEMONIZE = True + if os.path.isdir('/run'): + RUNDIR = '/run' + else: + RUNDIR = '/var/run' + pidfile = '{run}/x2gobroker/x2gobroker-daemon.pid'.format(run=RUNDIR) +except ImportError: + CAN_DAEMONIZE = False + from pwd import getpwnam from grp import getgrnam @@ -158,6 +169,11 @@ if __name__ == '__main__': {'args':['-p','--permissions'], 'default': '0660', 'help': 'set these file permissions for the AuthService socket file', }, ] + if CAN_DAEMONIZE: + common_options.extend([ + {'args':['-D', '--daemonize'], 'default': False, 'action': 'store_true', 'help': 'Detach the X2Go Broker process from the current terminal and fork to background', }, + {'args':['-P', '--pidfile'], 'default': pidfile, 'help': 'Alternative file path for the daemon\'s PID file', }, + ]) p = argparse.ArgumentParser(description='X2Go Session Broker (PAM Authentication Service)',\ formatter_class=argparse.RawDescriptionHelpFormatter, \ add_help=True, argument_default=None) @@ -171,9 +187,28 @@ if __name__ == '__main__': cmdline_args = p.parse_args() + if CAN_DAEMONIZE and cmdline_args.daemonize: + pidfile = os.path.expanduser(cmdline_args.pidfile) + if not os.path.isdir(os.path.dirname(pidfile)): + try: + os.makedirs(os.path.dirname(pidfile)) + except: + pass + if not os.access(os.path.dirname(pidfile), os.W_OK) or (os.path.exists(pidfile) and not os.access(pidfile, os.W_OK)): + print("") + p.print_usage() + print("Insufficent privileges. Cannot create PID file {pidfile} path".format(pidfile=pidfile)) + print("") + sys.exit(-3) + socket_file = cmdline_args.socket_file AuthService(socket_file, owner=cmdline_args.owner, group_owner=cmdline_args.group, permissions=cmdline_args.permissions) try: - loop() + if CAN_DAEMONIZE and cmdline_args.daemonize: + keep_fds = [int(fd) for fd in os.listdir('/proc/self/fd') if fd not in (0,1,2) ] + daemon = daemonize.Daemonize(app="x2gobroker", pid=pidfile, action=loop, keep_fds=keep_fds) + daemon.start() + else: + loop() except KeyboardInterrupt: pass hooks/post-receive -- x2gobroker.git (HTTP(S) Session broker for X2Go) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "x2gobroker.git" (HTTP(S) Session broker for X2Go).