/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-18 00:16:57 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090118001657-6mo3ae73ldy5tegf
* debian/mandos-client.postinst: Converted to Bourne shell.  Also
                                 minor message change.
* debian/mandos-client.postrm: Minor message change.
* debian/mandos.postinst: Converted to Bourne shell.  Also minor
                          message change.
* debian/mandos.prerm: Minor message change.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
# and some lines in "main".
12
12
13
13
# Everything else is
14
 
# Copyright © 2008 Teddy Hogeborn
15
 
# Copyright © 2008 Björn Påhlsson
 
14
# Copyright © 2008,2009 Teddy Hogeborn
 
15
# Copyright © 2008,2009 Björn Påhlsson
16
16
17
17
# This program is free software: you can redistribute it and/or modify
18
18
# it under the terms of the GNU General Public License as published by
35
35
 
36
36
import SocketServer
37
37
import socket
38
 
from optparse import OptionParser
 
38
import optparse
39
39
import datetime
40
40
import errno
41
41
import gnutls.crypto
66
66
import ctypes
67
67
import ctypes.util
68
68
 
69
 
version = "1.0.2"
 
69
version = "1.0.5"
70
70
 
71
71
logger = logging.Logger('mandos')
72
72
syslogger = (logging.handlers.SysLogHandler
889
889
 
890
890
 
891
891
def main():
892
 
    parser = OptionParser(version = "%%prog %s" % version)
 
892
    parser = optparse.OptionParser(version = "%%prog %s" % version)
893
893
    parser.add_option("-i", "--interface", type="string",
894
894
                      metavar="IF", help="Bind to interface IF")
895
895
    parser.add_option("-a", "--address", type="string",
972
972
    # Parse config file with clients
973
973
    client_defaults = { "timeout": "1h",
974
974
                        "interval": "5m",
975
 
                        "checker": "fping -q -- %(host)s",
 
975
                        "checker": "fping -q -- %%(host)s",
976
976
                        "host": "",
977
977
                        }
978
978
    client_config = ConfigParser.SafeConfigParser(client_defaults)
993
993
    
994
994
    try:
995
995
        uid = pwd.getpwnam("_mandos").pw_uid
 
996
        gid = pwd.getpwnam("_mandos").pw_gid
996
997
    except KeyError:
997
998
        try:
998
999
            uid = pwd.getpwnam("mandos").pw_uid
 
1000
            gid = pwd.getpwnam("mandos").pw_gid
999
1001
        except KeyError:
1000
1002
            try:
1001
1003
                uid = pwd.getpwnam("nobody").pw_uid
 
1004
                gid = pwd.getpwnam("nogroup").pw_gid
1002
1005
            except KeyError:
1003
1006
                uid = 65534
1004
 
    try:
1005
 
        gid = pwd.getpwnam("_mandos").pw_gid
1006
 
    except KeyError:
1007
 
        try:
1008
 
            gid = pwd.getpwnam("mandos").pw_gid
1009
 
        except KeyError:
1010
 
            try:
1011
 
                gid = pwd.getpwnam("nogroup").pw_gid
1012
 
            except KeyError:
1013
1007
                gid = 65534
1014
1008
    try:
1015
1009
        os.setuid(uid)
1135
1129
                        self.ClientRemoved(object_path)
1136
1130
                        return
1137
1131
                raise KeyError
 
1132
            @dbus.service.method(_interface)
 
1133
            def Quit(self):
 
1134
                main_loop.quit()
1138
1135
 
1139
1136
            del _interface
1140
1137