3 conf_replica = {'dbmodules': {'db': {'database_name': '$testdir/db.replica'}}}
6 acl_file = os.path.join(realm.testdir, 'kpropd-acl')
7 acl = open(acl_file, 'w')
8 acl.write(realm.host_princ + '\n')
11 def check_output(kpropd):
12 output('*** kpropd output follows\n')
14 line = kpropd.stdout.readline()
15 if 'Database load process for full propagation completed' in line:
17 output('kpropd: ' + line)
18 if 'Rejected connection' in line:
19 fail('kpropd rejected connection from kprop')
21 # kprop/kpropd are the only users of krb5_auth_con_initivector, so run
22 # this test over all enctypes to exercise mkpriv cipher state.
23 for realm in multipass_realms(create_user=False):
24 replica = realm.special_env('replica', True, kdc_conf=conf_replica)
26 # Set up the kpropd acl file.
29 # Create the replica db.
30 dumpfile = os.path.join(realm.testdir, 'dump')
31 realm.run([kdb5_util, 'dump', dumpfile])
32 realm.run([kdb5_util, 'load', dumpfile], replica)
33 realm.run([kdb5_util, 'stash', '-P', 'master'], replica)
35 # Make some changes to the master db.
36 realm.addprinc('wakawaka')
39 kpropd = realm.start_kpropd(replica, ['-d'])
41 realm.run([kdb5_util, 'dump', dumpfile])
42 realm.run([kprop, '-f', dumpfile, '-P', str(realm.kprop_port()), hostname])
45 realm.run([kadminl, 'listprincs'], replica, expected_msg='wakawaka')
47 # default_realm tests follow.
48 # default_realm and domain_realm different than realm.realm (test -r argument).
49 conf_rep2 = {'dbmodules': {'db': {'database_name': '$testdir/db.replica2'}}}
50 krb5_conf_rep2 = {'libdefaults': {'default_realm': 'FOO'},
51 'domain_realm': {hostname: 'FOO'}}
52 # default_realm and domain_realm map differ.
53 conf_rep3 = {'dbmodules': {'db': {'database_name': '$testdir/db.replica3'}}}
54 krb5_conf_rep3 = {'domain_realm': {hostname: 'BAR'}}
56 realm = K5Realm(create_user=False)
57 replica2 = realm.special_env('replica2', True, kdc_conf=conf_rep2,
58 krb5_conf=krb5_conf_rep2)
59 replica3 = realm.special_env('replica3', True, kdc_conf=conf_rep3,
60 krb5_conf=krb5_conf_rep3)
64 # Create the replica db.
65 dumpfile = os.path.join(realm.testdir, 'dump')
66 realm.run([kdb5_util, 'dump', dumpfile])
67 realm.run([kdb5_util, '-r', realm.realm, 'load', dumpfile], replica2)
68 realm.run([kdb5_util, 'load', dumpfile], replica3)
70 # Make some changes to the master db.
71 realm.addprinc('wakawaka')
73 # Test override of default_realm with -r realm argument.
74 kpropd = realm.start_kpropd(replica2, ['-r', realm.realm, '-d'])
75 realm.run([kdb5_util, 'dump', dumpfile])
76 realm.run([kprop, '-r', realm.realm, '-f', dumpfile, '-P',
77 str(realm.kprop_port()), hostname])
79 realm.run([kadminl, '-r', realm.realm, 'listprincs'], replica2,
80 expected_msg='wakawaka')
84 # Test default_realm and domain_realm mismatch.
85 kpropd = realm.start_kpropd(replica3, ['-d'])
86 realm.run([kdb5_util, 'dump', dumpfile])
87 realm.run([kprop, '-f', dumpfile, '-P', str(realm.kprop_port()), hostname])
89 realm.run([kadminl, 'listprincs'], replica3, expected_msg='wakawaka')
91 success('kprop tests')