/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: 2012-01-08 10:12:18 UTC
  • mfrom: (553 trunk)
  • mto: (237.4.29 release)
  • mto: This revision was merged to the branch mainline in revision 554.
  • Revision ID: teddy@recompile.se-20120108101218-h6yp0akairb23436
mergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
422
422
    secret:     bytestring; sent verbatim (over TLS) to client
423
423
    timeout:    datetime.timedelta(); How long from last_checked_ok
424
424
                                      until this client is disabled
425
 
    extended_timeout:   extra long timeout when password has been sent
 
425
    extended_timeout:   extra long timeout when secret has been sent
426
426
    runtime_expansions: Allowed attributes for runtime expansion.
427
427
    expires:    datetime.datetime(); time (UTC) when a client will be
428
428
                disabled, or None
1049
1049
    def __init__(self, bus = None, *args, **kwargs):
1050
1050
        self.bus = bus
1051
1051
        Client.__init__(self, *args, **kwargs)
1052
 
        self._approvals_pending = 0
1053
 
        
1054
 
        self._approvals_pending = 0
1055
1052
        # Only now, when this client is initialized, can it show up on
1056
1053
        # the D-Bus
1057
1054
        client_object_name = unicode(self.name).translate(
1227
1224
        "D-Bus signal"
1228
1225
        return self.need_approval()
1229
1226
    
1230
 
    # NeRwequest - signal
1231
 
    @dbus.service.signal(_interface, signature="s")
1232
 
    def NewRequest(self, ip):
1233
 
        """D-Bus signal
1234
 
        Is sent after a client request a password.
1235
 
        """
1236
 
        pass
1237
 
    
1238
1227
    ## Methods
1239
1228
    
1240
1229
    # Approve - method
1547
1536
                except KeyError:
1548
1537
                    return
1549
1538
                
1550
 
                if self.server.use_dbus:
1551
 
                    # Emit D-Bus signal
1552
 
                    client.NewRequest(str(self.client_address))
1553
 
                
1554
1539
                if client.approval_delay:
1555
1540
                    delay = client.approval_delay
1556
1541
                    client.approvals_pending += 1
2250
2235
            
2251
2236
            # Clients who has passed its expire date can still be
2252
2237
            # enabled if its last checker was successful.  Clients
2253
 
            # whose checker failed before we stored its state is
2254
 
            # assumed to have failed all checkers during downtime.
 
2238
            # whose checker succeeded before we stored its state is
 
2239
            # assumed to have successfully run all checkers during
 
2240
            # downtime.
2255
2241
            if client["enabled"]:
2256
2242
                if datetime.datetime.utcnow() >= client["expires"]:
2257
2243
                    if not client["last_checked_ok"]:
2258
2244
                        logger.warning(
2259
2245
                            "disabling client {0} - Client never "
2260
 
                            "performed a successfull checker"
2261
 
                            .format(client["name"]))
 
2246
                            "performed a successful checker"
 
2247
                            .format(client_name))
2262
2248
                        client["enabled"] = False
2263
2249
                    elif client["last_checker_status"] != 0:
2264
2250
                        logger.warning(
2265
2251
                            "disabling client {0} - Client "
2266
2252
                            "last checker failed with error code {1}"
2267
 
                            .format(client["name"],
 
2253
                            .format(client_name,
2268
2254
                                    client["last_checker_status"]))
2269
2255
                        client["enabled"] = False
2270
2256
                    else:
2273
2259
                                             + client["timeout"])
2274
2260
                        logger.debug("Last checker succeeded,"
2275
2261
                                     " keeping {0} enabled"
2276
 
                                     .format(client["name"]))
 
2262
                                     .format(client_name))
2277
2263
            try:
2278
2264
                client["secret"] = (
2279
2265
                    pgp.decrypt(client["encrypted_secret"],
2295
2281
                        - set(old_client_settings)):
2296
2282
        clients_data[client_name] = client_settings[client_name]
2297
2283
 
2298
 
    # Create clients all clients
 
2284
    # Create all client objects
2299
2285
    for client_name, client in clients_data.iteritems():
2300
2286
        tcp_server.clients[client_name] = client_class(
2301
2287
            name = client_name, settings = client)