/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:
699
699
            session.bye()
700
700
            return
701
701
        logger.debug(u"Fingerprint: %s", fpr)
 
702
        
702
703
        for c in self.server.clients:
703
704
            if c.fingerprint == fpr:
704
705
                client = c
790
791
 
791
792
def string_to_delta(interval):
792
793
    """Parse a string and return a datetime.timedelta
793
 
 
 
794
    
794
795
    >>> string_to_delta('7d')
795
796
    datetime.timedelta(7)
796
797
    >>> string_to_delta('60s')
969
970
    # For convenience
970
971
    debug = server_settings["debug"]
971
972
    use_dbus = server_settings["use_dbus"]
 
973
 
 
974
    def sigsegvhandler(signum, frame):
 
975
        raise RuntimeError('Segmentation fault')
972
976
    
973
977
    if not debug:
974
978
        syslogger.setLevel(logging.WARNING)
975
979
        console.setLevel(logging.WARNING)
 
980
    else:
 
981
        signal.signal(signal.SIGSEGV, sigsegvhandler)
976
982
    
977
983
    if server_settings["servicename"] != "Mandos":
978
984
        syslogger.setFormatter(logging.Formatter
1017
1023
                uid = 65534
1018
1024
                gid = 65534
1019
1025
    try:
 
1026
        os.setgid(gid)
1020
1027
        os.setuid(uid)
1021
 
        os.setgid(gid)
1022
1028
    except OSError, error:
1023
1029
        if error[0] != errno.EPERM:
1024
1030
            raise error
1025
1031
    
 
1032
    # Enable all possible GnuTLS debugging
 
1033
    if debug:
 
1034
        # "Use a log level over 10 to enable all debugging options."
 
1035
        # - GnuTLS manual
 
1036
        gnutls.library.functions.gnutls_global_set_log_level(11)
 
1037
        
 
1038
        @gnutls.library.types.gnutls_log_func
 
1039
        def debug_gnutls(level, string):
 
1040
            logger.debug("GnuTLS: %s", string[:-1])
 
1041
        
 
1042
        (gnutls.library.functions
 
1043
         .gnutls_global_set_log_function(debug_gnutls))
 
1044
    
1026
1045
    global service
1027
1046
    service = AvahiService(name = server_settings["servicename"],
1028
1047
                           servicetype = "_mandos._tcp", )