/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-list

  • Committer: Teddy Hogeborn
  • Date: 2008-09-05 07:11:24 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080905071124-9dq11jq5rfd6zfxf
* Makefile: Changed to use symbolic instead of octal modes throughout.
  (KEYDIR): New variable for the key directory.
  (install-server): Bug fix: remove "--parents" from install args.
  (install-client): Bug fix: - '' -  Also create key directory.  Do
                    not chmod plugin dir.  Create custom plugin directory
                    if not the same as normal plugin directory.  Add
                    "--dir" option to "mandos-keygen".  Add note about
                    running "mandos-keygen --password".
  (uninstall-server): Do not depend on the installed server binary,
                      since this made it impossible to do a purge
                      after an uninstall.
  (purge-client): Shred seckey.txt.  Use $(KEYDIR).

* README: Improved wording.

* initramfs-tools-hook: Use a loop to find prefix.  Also find keydir.
                        Remove "${DESTDIR}" from "copy_exec".  Do not
                        try to copy literal "*" if no custom plugins
                        are found.  Copy key files from keydir, not
                        config dir.  Only repair mode on directories
                        that actually exist.  Do not run chmod if
                        nothing needs repairing.

* plugin-runner.conf: New file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
 
3
 
import dbus
4
 
from optparse import OptionParser
5
 
 
6
 
tablewords = {
7
 
    'name': 'Name',
8
 
    'enabled': 'Enabled',
9
 
    'timeout': 'Timeout',
10
 
    'last_checked_ok': 'Last Successful Check',
11
 
    'created': 'Created',
12
 
    'interval': 'Interval',
13
 
    'host': 'Host',
14
 
    'fingerprint': 'Fingerprint',
15
 
    'checker_running': 'Check Is Running',
16
 
    'last_enabled': 'Last Enabled',
17
 
    'checker': 'Checker',
18
 
    }
19
 
busname = 'org.mandos-system.Mandos'
20
 
object_path = '/Mandos'
21
 
interface = 'org.mandos_system.Mandos'
22
 
version = "1.0.0"
23
 
defaultkeywords = ('name', 'enabled', 'timeout', 'last_checked_ok', 'checker')
24
 
 
25
 
parser = OptionParser(version = "%%prog %s" % version)
26
 
parser.add_option("-a", "--all", action="store_true", default=False,
27
 
                      help="Print all fields")
28
 
options = parser.parse_args()[0]
29
 
if options.all:
30
 
    keywords = ( 'name', 'enabled', 'timeout', 'last_checked_ok',
31
 
                 'created', 'interval', 'host', 'fingerprint',
32
 
                 'checker_running', 'last_enabled', 'checker' )
33
 
else:
34
 
    keywords = defaultkeywords
35
 
 
36
 
 
37
 
bus = dbus.SystemBus()
38
 
mandos_dbus_objc = bus.get_object(busname, object_path)
39
 
mandos_serv = dbus.Interface(mandos_dbus_objc, dbus_interface = interface)
40
 
mandos_clients = mandos_serv.GetAllClientsWithProperties()
41
 
 
42
 
def valuetostring(x):
43
 
    if type(x) is dbus.Boolean:
44
 
        return "Yes" if x else "No"
45
 
    else:
46
 
        return str(x)
47
 
 
48
 
format_string = ' '.join('%%-%ds'
49
 
                         % max(len(tablewords[key]),
50
 
                               max(len(valuetostring(client[key]))
51
 
                                   for client
52
 
                                   in mandos_clients.itervalues()))
53
 
                         for key in keywords)
54
 
print format_string % tuple(tablewords[key] for key in keywords) 
55
 
for client in mandos_clients.itervalues():
56
 
    print format_string % tuple(valuetostring(client[key]) for key in keywords)
57
 
 
58