/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to mandos-ctl

  • Committer: Teddy Hogeborn
  • Date: 2016-06-03 17:18:46 UTC
  • mto: (237.7.594 trunk)
  • mto: This revision was merged to the branch mainline in revision 343.
  • Revision ID: teddy@recompile.se-20160603171846-zr11h4gshlkgoona
mandos-keygen: Try to use ECDSA keys with ssh-keyscan(1) by default.

* mandos-keygen (password): Add "ecdsa-sha2-nistp256" first in list of
                            SSH key types to try to scan for.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
import os
40
40
import collections
41
41
import doctest
42
 
import json
43
42
 
44
43
import dbus
45
44
 
73
72
server_path = "/"
74
73
server_interface = domain + ".Mandos"
75
74
client_interface = domain + ".Mandos.Client"
76
 
version = "1.7.10"
 
75
version = "1.7.7"
77
76
 
78
77
 
79
78
try:
281
280
                        help="Select all clients")
282
281
    parser.add_argument("-v", "--verbose", action="store_true",
283
282
                        help="Print all fields")
284
 
    parser.add_argument("-j", "--dump-json", action="store_true",
285
 
                        help="Dump client data in JSON format")
286
283
    parser.add_argument("-e", "--enable", action="store_true",
287
284
                        help="Enable client")
288
285
    parser.add_argument("-d", "--disable", action="store_true",
331
328
    if has_actions(options) and not (options.client or options.all):
332
329
        parser.error("Options require clients names or --all.")
333
330
    if options.verbose and has_actions(options):
334
 
        parser.error("--verbose can only be used alone.")
335
 
    if options.dump_json and (options.verbose or has_actions(options)):
336
 
        parser.error("--dump-json can only be used alone.")
 
331
        parser.error("--verbose can only be used alone or with"
 
332
                     " --all.")
337
333
    if options.all and not has_actions(options):
338
334
        parser.error("--all requires an action.")
339
 
    
 
335
 
340
336
    if options.check:
341
337
        fail_count, test_count = doctest.testmod()
342
338
        sys.exit(os.EX_OK if fail_count == 0 else 1)
393
389
                sys.exit(1)
394
390
    
395
391
    if not has_actions(options) and clients:
396
 
        if options.verbose or options.dump_json:
 
392
        if options.verbose:
397
393
            keywords = ("Name", "Enabled", "Timeout", "LastCheckedOK",
398
394
                        "Created", "Interval", "Host", "Fingerprint",
399
395
                        "CheckerRunning", "LastEnabled",
404
400
        else:
405
401
            keywords = defaultkeywords
406
402
        
407
 
        if options.dump_json:
408
 
            json.dump({client["Name"]: {key:
409
 
                                        bool(client[key])
410
 
                                        if isinstance(client[key],
411
 
                                                      dbus.Boolean)
412
 
                                        else client[key]
413
 
                                        for key in keywords }
414
 
                       for client in clients.values() },
415
 
                      fp = sys.stdout, indent = 4,
416
 
                      separators = (',', ': '))
417
 
            print()
418
 
        else:
419
 
            print_clients(clients.values(), keywords)
 
403
        print_clients(clients.values(), keywords)
420
404
    else:
421
405
        # Process each client in the list by all selected options
422
406
        for client in clients: