/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-02-03 22:41:49 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090203224149-fc1301jojmusbzlx
* Makefile (run-server): Use "--no-dbus" unconditionally.

* initramfs-tools-script: Correct tests for writable "/conf/conf.d".

* mandos: Add process ID number to logging messages.
  (IPv6_TCPServer.server_bind): Use plain "raise".
  (main): Do not try to handle SIGSEGV; it does not work.  Use plain
         "raise".  Log KeyboardInterrupt and server exit.

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