summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2012-09-03 18:06:44 -0500
committerGreg Hudson <ghudson@mit.edu>2012-10-08 11:51:10 -0400
commit3c5745e8b90baedf2ec6f42fc0ff40ce80aea001 (patch)
tree5e07463bbb360e861f76800cf8640c7824293281 /src/util
parente41971145349e1f55b6cb3336c014bd8edcb22da (diff)
downloadkrb5-3c5745e8b90baedf2ec6f42fc0ff40ce80aea001.tar.gz
krb5-3c5745e8b90baedf2ec6f42fc0ff40ce80aea001.tar.xz
krb5-3c5745e8b90baedf2ec6f42fc0ff40ce80aea001.zip
Prep k5test.py for iprop (add start_kpropd(), ...)
Add a start_kpropd() method to K5Realm and make start_kadmind() use the kadmind -p, -K, and -F options. ticket: 7378
Diffstat (limited to 'src/util')
-rw-r--r--src/util/k5test.py48
1 files changed, 42 insertions, 6 deletions
diff --git a/src/util/k5test.py b/src/util/k5test.py
index f771619469..6af782c729 100644
--- a/src/util/k5test.py
+++ b/src/util/k5test.py
@@ -97,7 +97,9 @@ keyword arguments:
- port0 is used in the default krb5.conf for the KDC
- port1 is used in the default krb5.conf for kadmind
- port2 is used in the default krb5.conf for kpasswd
- - port3 is the return value of realm.server_port()
+ - port3 is used in the default krb5.conf for kpropd
+ - port4 is used in the default krb5.conf for iprop (in kadmind)
+ - port5 is the return value of realm.server_port()
* kdc_conf={...}: kdc.conf options, expressed as a nested dictionary,
to be merged with the default kdc.conf settings. The top level keys
@@ -121,6 +123,8 @@ keyword arguments:
* start_kadmind=True: Start kadmind.
+* start_kpropd=True: Start kpropd.
+
* get_creds=False: Don't get user credentials.
Scripts may use the following functions and variables:
@@ -247,6 +251,9 @@ Scripts may use the following realm methods and attributes:
* realm.start_kadmind(): Start a kadmind with the realm's master KDC
environment. Errors if a kadmind is already running.
+* realm.start_kpropd(): Start a kpropd with the realm's slave KDC
+ environment. Errors if a kpropd is already running.
+
* realm.stop_kadmind(): Stop the kadmind process. Errors if no
kadmind is running.
@@ -697,7 +704,8 @@ class K5Realm(object):
def __init__(self, realm='KRBTEST.COM', portbase=61000, testdir='testdir',
krb5_conf=None, kdc_conf=None, create_kdb=True,
krbtgt_keysalt=None, create_user=True, get_creds=True,
- create_host=True, start_kdc=True, start_kadmind=False):
+ create_host=True, start_kdc=True, start_kadmind=False,
+ start_kpropd=False):
global hostname, _default_krb5_conf, _default_kdc_conf
self.realm = realm
@@ -716,6 +724,7 @@ class K5Realm(object):
self._kdc_conf = _cfg_merge(_default_kdc_conf, kdc_conf)
self._kdc_proc = None
self._kadmind_proc = None
+ self._kpropd_proc = None
self._create_empty_dir()
self._create_krb5_conf('client')
@@ -747,6 +756,8 @@ class K5Realm(object):
self.start_kdc()
if start_kadmind and create_kdb:
self.start_kadmind()
+ if start_kpropd and create_kdb:
+ self.start_kpropd()
if get_creds and create_kdb and create_user and start_kdc:
self.kinit(self.user_princ, password('user'))
self.klist(self.user_princ)
@@ -842,6 +853,8 @@ class K5Realm(object):
env['KRB5_KTNAME'] = self.keytab
env['KRB5_CLIENT_KTNAME'] = self.client_keytab
env['KRB5RCACHEDIR'] = self.testdir
+ env['KPROPD_PORT'] = str(self.portbase + 3)
+ env['KPROP_PORT'] = str(self.portbase + 3)
return env
def run_as_client(self, args, **keywords):
@@ -857,7 +870,7 @@ class K5Realm(object):
return _run_cmd(args, self.env_slave, **keywords)
def server_port(self):
- return self.portbase + 3
+ return self.portbase + 5
def start_server(self, args, sentinel):
return _start_daemon(args, self.env_server, sentinel)
@@ -886,19 +899,41 @@ class K5Realm(object):
def start_kadmind(self):
global krb5kdc
assert(self._kadmind_proc is None)
- self._kadmind_proc = _start_daemon([kadmind, '-nofork', '-W'],
- self.env_master, 'starting...')
+ dump_path = os.path.join(self.testdir, 'master-dump')
+ self._kadmind_proc = _start_daemon([kadmind, '-nofork', '-W',
+ '-p', kdb5_util, '-K', kprop,
+ '-F', dump_path],
+ self.env_master, 'starting...')
def stop_kadmind(self):
assert(self._kadmind_proc is not None)
stop_daemon(self._kadmind_proc)
self._kadmind_proc = None
+ def start_kpropd(self):
+ global krb5kdc
+ assert(self._kpropd_proc is None)
+ slavedump_path = os.path.join(self.testdir, 'incoming-slave-datatrans')
+ kpropdacl_path = os.path.join(self.testdir, 'kpropd-acl')
+ self._kpropd_proc = _start_daemon([kpropd, '-D', '-P',
+ str(self.portbase + 3),
+ '-f', slavedump_path,
+ '-p', kdb5_util,
+ '-a', kpropdacl_path],
+ self.env_slave, 'ready')
+
+ def stop_kpropd(self):
+ assert(self._kpropd_proc is not None)
+ stop_daemon(self._kpropd_proc)
+ self._kpropd_proc = None
+
def stop(self):
if self._kdc_proc:
self.stop_kdc()
if self._kadmind_proc:
self.stop_kadmind()
+ if self._kpropd_proc:
+ self.stop_kpropd()
def addprinc(self, princname, password=None):
if password:
@@ -1063,7 +1098,8 @@ _default_kdc_conf = {
'all' : {
'realms' : {
'$realm' : {
- 'database_module' : 'foo_db2'
+ 'database_module' : 'foo_db2',
+ 'iprop_port' : '$port4'
}
},
'dbmodules' : {