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

  • Committer: Teddy Hogeborn
  • Date: 2015-07-09 20:32:52 UTC
  • Revision ID: teddy@recompile.se-20150709203252-u10p7trfsxc1a9yp
Install client Diffie-Hellman parameters into initramfs.

* debian/control (Package: mandos-client/Recommends): Added
  "gnutls-bin | openssl" (to generate DH parameters).
* debian/mandos-client.postinst (create_dh_params): New function
                                                    called on package
                                                    configure.
* plugins.d/mandos-client.c (main): Bug fix: Work around Debian bug
                                    #633582 also for the
                                    "client-dhparams.pem" file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
4
4
# Mandos Monitor - Control and monitor the Mandos server
5
5
6
 
# Copyright © 2009-2014 Teddy Hogeborn
7
 
# Copyright © 2009-2014 Björn Påhlsson
 
6
# Copyright © 2009-2015 Teddy Hogeborn
 
7
# Copyright © 2009-2015 Björn Påhlsson
8
8
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
60
domain = 'se.recompile'
61
61
server_interface = domain + '.Mandos'
62
62
client_interface = domain + '.Mandos.Client'
63
 
version = "1.6.8"
 
63
version = "1.6.9"
64
64
 
65
65
def isoformat_to_datetime(iso):
66
66
    "Parse an ISO 8601 date string to a datetime.datetime()"
87
87
        self.proxy = proxy_object # Mandos Client proxy object
88
88
        self.properties = dict() if properties is None else properties
89
89
        self.property_changed_match = (
90
 
            self.proxy.connect_to_signal("PropertyChanged",
91
 
                                         self._property_changed,
92
 
                                         client_interface,
 
90
            self.proxy.connect_to_signal("PropertiesChanged",
 
91
                                         self.properties_changed,
 
92
                                         dbus.PROPERTIES_IFACE,
93
93
                                         byte_arrays=True))
94
94
        
95
95
        if properties is None:
100
100
        
101
101
        super(MandosClientPropertyCache, self).__init__(**kwargs)
102
102
    
103
 
    def _property_changed(self, property, value):
104
 
        """Helper which takes positional arguments"""
105
 
        return self.property_changed(property=property, value=value)
106
 
    
107
 
    def property_changed(self, property=None, value=None):
108
 
        """This is called whenever we get a PropertyChanged signal
109
 
        It updates the changed property in the "properties" dict.
 
103
    def properties_changed(self, interface, properties, invalidated):
 
104
        """This is called whenever we get a PropertiesChanged signal
 
105
        It updates the changed properties in the "properties" dict.
110
106
        """
111
107
        # Update properties dict with new value
112
 
        self.properties[property] = value
 
108
        self.properties.update(properties)
113
109
    
114
110
    def delete(self):
115
111
        self.property_changed_match.remove()
177
173
            gobject.source_remove(self._update_timer_callback_tag)
178
174
            self._update_timer_callback_tag = None
179
175
    
180
 
    def checker_completed(self, exitstatus, condition, command):
 
176
    def checker_completed(self, exitstatus, signal, command):
181
177
        if exitstatus == 0:
182
178
            self.logger('Checker for client {} (command "{}")'
183
179
                        ' succeeded'.format(self.properties["Name"],
185
181
            self.update()
186
182
            return
187
183
        # Checker failed
188
 
        if os.WIFEXITED(condition):
 
184
        if exitstatus >= 0:
189
185
            self.logger('Checker for client {} (command "{}") failed'
190
186
                        ' with exit code {}'
191
187
                        .format(self.properties["Name"], command,
192
 
                                os.WEXITSTATUS(condition)))
193
 
        elif os.WIFSIGNALED(condition):
 
188
                                exitstatus))
 
189
        elif signal != 0:
194
190
            self.logger('Checker for client {} (command "{}") was'
195
191
                        ' killed by signal {}'
196
192
                        .format(self.properties["Name"], command,
197
 
                                os.WTERMSIG(condition)))
198
 
        elif os.WCOREDUMP(condition):
199
 
            self.logger('Checker for client {} (command "{}") dumped'
200
 
                        ' core'.format(self.properties["Name"],
201
 
                                       command))
 
193
                                signal))
202
194
        else:
203
195
            self.logger('Checker for client {} completed'
204
196
                        ' mysteriously'
377
369
        else:
378
370
            return key
379
371
    
380
 
    def property_changed(self, property=None, **kwargs):
381
 
        """Call self.update() if old value is not new value.
 
372
    def properties_changed(self, interface, properties, invalidated):
 
373
        """Call self.update() if any properties changed.
382
374
        This overrides the method from MandosClientPropertyCache"""
383
 
        property_name = str(property)
384
 
        old_value = self.properties.get(property_name)
385
 
        super(MandosClientWidget, self).property_changed(
386
 
            property=property, **kwargs)
387
 
        if self.properties.get(property_name) != old_value:
 
375
        old_values = { key: self.properties.get(key)
 
376
                       for key in properties.keys() }
 
377
        super(MandosClientWidget, self).properties_changed(
 
378
            interface, properties, invalidated)
 
379
        if any(old_values[key] != self.properties.get(key)
 
380
               for key in old_values):
388
381
            self.update()
389
382
 
390
383