/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2009-01-31 10:33:17 UTC
  • mfrom: (24.1.129 mandos)
  • Revision ID: teddy@fukt.bsnet.se-20090131103317-wzqvyr532sjcjt7u
Merge from Björn:

* mandos-ctl: New option "--remove-client".  Only default to listing
              clients if no clients were given on the command line.
* plugins.d/mandos-client.c: Lower kernel log level while bringing up
                             network interface.  New option "--delay"
                             to control the maximum delay to wait for
                             running interface.
* plugins.d/mandos-client.xml (SYNOPSIS, OPTIONS): New option
                                                   "--delay".

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
             (facility = logging.handlers.SysLogHandler.LOG_DAEMON,
74
74
              address = "/dev/log"))
75
75
syslogger.setFormatter(logging.Formatter
76
 
                       ('Mandos [%(process)d]: %(levelname)s:'
77
 
                        ' %(message)s'))
 
76
                       ('Mandos: %(levelname)s: %(message)s'))
78
77
logger.addHandler(syslogger)
79
78
 
80
79
console = logging.StreamHandler()
81
 
console.setFormatter(logging.Formatter('%(name)s [%(process)d]:'
82
 
                                       ' %(levelname)s: %(message)s'))
 
80
console.setFormatter(logging.Formatter('%(name)s: %(levelname)s:'
 
81
                                       ' %(message)s'))
83
82
logger.addHandler(console)
84
83
 
85
84
class AvahiError(Exception):
677
676
        # using OpenPGP certificates.
678
677
        
679
678
        #priority = ':'.join(("NONE", "+VERS-TLS1.1", "+AES-256-CBC",
680
 
        #                     "+SHA1", "+COMP-NULL", "+CTYPE-OPENPGP",
681
 
        #                     "+DHE-DSS"))
 
679
        #                "+SHA1", "+COMP-NULL", "+CTYPE-OPENPGP",
 
680
        #                "+DHE-DSS"))
682
681
        # Use a fallback default, since this MUST be set.
683
682
        priority = self.server.settings.get("priority", "NORMAL")
684
683
        (gnutls.library.functions
765
764
                                 u" bind to interface %s",
766
765
                                 self.settings["interface"])
767
766
                else:
768
 
                    raise
 
767
                    raise error
769
768
        # Only bind(2) the socket if we really need to.
770
769
        if self.server_address[0] or self.server_address[1]:
771
770
            if not self.server_address[0]:
971
970
    # For convenience
972
971
    debug = server_settings["debug"]
973
972
    use_dbus = server_settings["use_dbus"]
 
973
 
 
974
    def sigsegvhandler(signum, frame):
 
975
        raise RuntimeError('Segmentation fault')
974
976
    
975
977
    if not debug:
976
978
        syslogger.setLevel(logging.WARNING)
977
979
        console.setLevel(logging.WARNING)
 
980
    else:
 
981
        signal.signal(signal.SIGSEGV, sigsegvhandler)
978
982
    
979
983
    if server_settings["servicename"] != "Mandos":
980
984
        syslogger.setFormatter(logging.Formatter
1001
1005
    pidfilename = "/var/run/mandos.pid"
1002
1006
    try:
1003
1007
        pidfile = open(pidfilename, "w")
1004
 
    except IOError:
 
1008
    except IOError, error:
1005
1009
        logger.error("Could not open file %r", pidfilename)
1006
1010
    
1007
1011
    try:
1200
1204
        sys.exit(1)
1201
1205
    except KeyboardInterrupt:
1202
1206
        if debug:
1203
 
            print >> sys.stderr
1204
 
        logger.debug("Server received KeyboardInterrupt")
1205
 
    logger.debug("Server exiting")
 
1207
            print
1206
1208
 
1207
1209
if __name__ == '__main__':
1208
1210
    main()