4
4
# Mandos Monitor - Control and monitor the Mandos server
6
# Copyright © 2009-2014 Teddy Hogeborn
7
# Copyright © 2009-2014 Björn Påhlsson
6
# Copyright © 2009-2012 Teddy Hogeborn
7
# Copyright © 2009-2012 Björn Påhlsson
9
9
# This program is free software: you can redistribute it and/or modify
10
10
# it under the terms of the GNU General Public License as published by
60
55
domain = 'se.recompile'
61
56
server_interface = domain + '.Mandos'
62
57
client_interface = domain + '.Mandos.Client'
60
# Always run in monochrome mode
61
urwid.curses_display.curses.has_colors = lambda : False
63
# Urwid doesn't support blinking, but we want it. Since we have no
64
# use for underline on its own, we make underline also always blink.
65
urwid.curses_display.curses.A_UNDERLINE |= (
66
urwid.curses_display.curses.A_BLINK)
65
68
def isoformat_to_datetime(iso):
66
69
"Parse an ISO 8601 date string to a datetime.datetime()"
276
279
message = "Approval in {0}. (d)eny?"
278
281
message = "Denial in {0}. (a)pprove?"
279
message = message.format(str(timer).rsplit(".", 1)[0])
282
message = message.format(unicode(timer).rsplit(".", 1)[0])
280
283
self.using_timer(True)
281
284
elif self.properties["LastCheckerStatus"] != 0:
282
285
# When checker has failed, show timer until client expires
379
382
def property_changed(self, property=None, **kwargs):
380
383
"""Call self.update() if old value is not new value.
381
384
This overrides the method from MandosClientPropertyCache"""
382
property_name = str(property)
385
property_name = unicode(property)
383
386
old_value = self.properties.get(property_name)
384
387
super(MandosClientWidget, self).property_changed(
385
388
property=property, **kwargs)
413
416
"default", "default", None),
415
"bold", "default", "bold"),
418
"default", "default", "bold"),
416
419
("underline-blink",
417
"underline,blink", "default", "underline,blink"),
420
"default", "default", "underline"),
419
"standout", "default", "standout"),
422
"default", "default", "standout"),
420
423
("bold-underline-blink",
421
"bold,underline,blink", "default", "bold,underline,blink"),
424
"default", "default", ("bold", "underline")),
422
425
("bold-standout",
423
"bold,standout", "default", "bold,standout"),
426
"default", "default", ("bold", "standout")),
424
427
("underline-blink-standout",
425
"underline,blink,standout", "default",
426
"underline,blink,standout"),
428
"default", "default", ("underline", "standout")),
427
429
("bold-underline-blink-standout",
428
"bold,underline,blink,standout", "default",
429
"bold,underline,blink,standout"),
430
"default", "default", ("bold", "underline",
432
434
if urwid.supports_unicode():
581
588
if not mandos_clients:
582
589
self.log_message_raw(("bold", "Note: Server has no clients."))
583
590
except dbus.exceptions.DBusException:
584
self.log_message_raw(("bold", "Note: No Mandos server running."))
591
self.log_message_raw(("bold", "Note: No Mandos servers running."))
585
592
mandos_clients = dbus.Dictionary()
587
594
(self.mandos_serv
599
606
self.client_not_found,
600
607
dbus_interface=server_interface,
601
608
byte_arrays=True))
602
for path, client in mandos_clients.items():
609
for path, client in mandos_clients.iteritems():
603
610
client_proxy_object = self.bus.get_object(self.busname,
605
612
self.add_client(MandosClientWidget(server_proxy_object