4
4
# Mandos Monitor - Control and monitor the Mandos server
6
# Copyright © 2009-2011 Teddy Hogeborn
7
# Copyright © 2009-2011 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
19
19
# You should have received a copy of the GNU General Public License
20
20
# along with this program. If not, see <http://www.gnu.org/licenses/>.
22
# Contact the authors at <mandos@fukt.bsnet.se>.
22
# Contact the authors at <mandos@recompile.se>.
25
25
from __future__ import (division, absolute_import, print_function,
244
244
def checker_started(self, command):
245
"""Server signals that a checker started. This could be useful
246
to log in the future. """
245
247
#self.logger('Client %s started checker "%s"'
246
248
# % (self.properties["Name"], unicode(command)))
498
500
self.busname = domain + '.Mandos'
499
501
self.main_loop = gobject.MainLoop()
500
self.bus = dbus.SystemBus()
501
mandos_dbus_objc = self.bus.get_object(
502
self.busname, "/", follow_name_owner_changes=True)
503
self.mandos_serv = dbus.Interface(mandos_dbus_objc,
507
mandos_clients = (self.mandos_serv
508
.GetAllClientsWithProperties())
509
except dbus.exceptions.DBusException:
510
mandos_clients = dbus.Dictionary()
513
.connect_to_signal("ClientRemoved",
514
self.find_and_remove_client,
515
dbus_interface=server_interface,
518
.connect_to_signal("ClientAdded",
520
dbus_interface=server_interface,
523
.connect_to_signal("ClientNotFound",
524
self.client_not_found,
525
dbus_interface=server_interface,
527
for path, client in mandos_clients.iteritems():
528
client_proxy_object = self.bus.get_object(self.busname,
530
self.add_client(MandosClientWidget(server_proxy_object
533
=client_proxy_object,
543
503
def client_not_found(self, fingerprint, address):
544
504
self.log_message(("Client with address %s and fingerprint %s"
651
610
"""Start the main loop and exit when it's done."""
611
self.bus = dbus.SystemBus()
612
mandos_dbus_objc = self.bus.get_object(
613
self.busname, "/", follow_name_owner_changes=True)
614
self.mandos_serv = dbus.Interface(mandos_dbus_objc,
618
mandos_clients = (self.mandos_serv
619
.GetAllClientsWithProperties())
620
except dbus.exceptions.DBusException:
621
mandos_clients = dbus.Dictionary()
624
.connect_to_signal("ClientRemoved",
625
self.find_and_remove_client,
626
dbus_interface=server_interface,
629
.connect_to_signal("ClientAdded",
631
dbus_interface=server_interface,
634
.connect_to_signal("ClientNotFound",
635
self.client_not_found,
636
dbus_interface=server_interface,
638
for path, client in mandos_clients.iteritems():
639
client_proxy_object = self.bus.get_object(self.busname,
641
self.add_client(MandosClientWidget(server_proxy_object
644
=client_proxy_object,
653
655
self._input_callback_tag = (gobject.io_add_watch
654
656
(sys.stdin.fileno(),