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

  • Committer: Teddy Hogeborn
  • Date: 2009-11-01 00:10:28 UTC
  • Revision ID: teddy@fukt.bsnet.se-20091101001028-hf4mbnoz1yum7bkf
* Makefile (BROKEN_PIE): Add comment.
* debian/rules (BROKEN_PIE): - '' -
* plugin-runner.c: Really always use <sysexits.h> exit codes.
* plugins.d/mandos-client.c: Use <sysexits.h> exit codes.
  (start_mandos_communication): Make sure errno is always set when
                                returning -1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    'last_enabled': u'Last Enabled',
25
25
    'checker': u'Checker',
26
26
    }
27
 
defaultkeywords = ('name', 'enabled', 'timeout', 'last_checked_ok')
 
27
defaultkeywords = ('name', 'enabled', 'timeout', 'last_checked_ok',
 
28
                   'checker')
28
29
domain = 'se.bsnet.fukt'
29
30
busname = domain + '.Mandos'
30
31
server_path = '/'
31
32
server_interface = domain + '.Mandos'
32
33
client_interface = domain + '.Mandos.Client'
33
34
version = "1.0.14"
34
 
try:
35
 
    bus = dbus.SystemBus()
36
 
    mandos_dbus_objc = bus.get_object(busname, server_path)
37
 
except dbus.exceptions.DBusException:
38
 
    sys.exit(1)
39
 
    
 
35
bus = dbus.SystemBus()
 
36
mandos_dbus_objc = bus.get_object(busname, server_path)
40
37
mandos_serv = dbus.Interface(mandos_dbus_objc,
41
38
                             dbus_interface = server_interface)
42
39
mandos_clients = mandos_serv.GetAllClientsWithProperties()
131
128
                  help="Start checker for client")
132
129
parser.add_option("--stop-checker", action="store_true",
133
130
                  help="Stop checker for client")
134
 
parser.add_option("-V", "--is-enabled", action="store_true",
135
 
                  help="Check if client is enabled")
 
131
parser.add_option("-V", "--is-valid", action="store_true",
 
132
                  help="Check if client is still valid")
136
133
parser.add_option("-r", "--remove", action="store_true",
137
134
                  help="Remove client")
138
135
parser.add_option("-c", "--checker", type="string",
145
142
                  help="Set host for client")
146
143
parser.add_option("-s", "--secret", type="string",
147
144
                  help="Set password blob (file) for client")
148
 
parser.add_option("-A", "--approve", action="store_true",
149
 
                  help="Approve any current client request")
150
 
parser.add_option("-D", "--deny", action="store_true",
151
 
                  help="Deny any current client request")
152
145
options, client_names = parser.parse_args()
153
146
 
154
147
# Compile list of clients to process
185
178
        client.StartChecker(dbus_interface=client_interface)
186
179
    if options.stop_checker:
187
180
        client.StopChecker(dbus_interface=client_interface)
188
 
    if options.is_enabled:
 
181
    if options.is_valid:
189
182
        sys.exit(0 if client.Get(client_interface,
190
183
                                 u"enabled",
191
184
                                 dbus_interface=dbus.PROPERTIES_IFACE)
210
203
        client.Set(client_interface, u"secret",
211
204
                   dbus.ByteArray(open(options.secret, u'rb').read()),
212
205
                   dbus_interface=dbus.PROPERTIES_IFACE)
213
 
    if options.approve:
214
 
        client.Approve(dbus.Boolean(True), dbus_interface=client_interface)
215
 
    if options.deny:
216
 
        client.Approve(dbus.Boolean(False), dbus_interface=client_interface)