xref: /freebsd/crypto/krb5/src/lib/kadm5/t_kadm5.py (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubertfrom k5test import *
2*7f2fe78bSCy Schubert
3*7f2fe78bSCy Schubert# Specify a supported_enctypes so the chpass tests know what to expect.
4*7f2fe78bSCy Schubertsupported_enctypes = 'aes256-cts:normal aes128-cts:normal'
5*7f2fe78bSCy Schubertconf = {'realms': {'$realm': {'supported_enctypes': supported_enctypes}}}
6*7f2fe78bSCy Schubertrealm = K5Realm(create_user=False, create_host=False, kdc_conf=conf)
7*7f2fe78bSCy Schubert
8*7f2fe78bSCy Schubertwith open(os.path.join(realm.testdir, 'acl'), 'w') as f:
9*7f2fe78bSCy Schubert    f.write('''
10*7f2fe78bSCy Schubertadmin                   admcilse
11*7f2fe78bSCy Schubertadmin/get               il
12*7f2fe78bSCy Schubertadmin/modify            mc
13*7f2fe78bSCy Schubertadmin/delete            d
14*7f2fe78bSCy Schubertadmin/add               a
15*7f2fe78bSCy Schubertadmin/rename            adil
16*7f2fe78bSCy Schubert''')
17*7f2fe78bSCy Schubert
18*7f2fe78bSCy Schubertwith open(os.path.join(realm.testdir, 'dictfile'), 'w') as f:
19*7f2fe78bSCy Schubert    f.write('''
20*7f2fe78bSCy SchubertAbyssinia
21*7f2fe78bSCy SchubertDiscordianism
22*7f2fe78bSCy Schubertfoo
23*7f2fe78bSCy Schubert''')
24*7f2fe78bSCy Schubert
25*7f2fe78bSCy Schubertrealm.start_kadmind()
26*7f2fe78bSCy Schubert
27*7f2fe78bSCy Schubertrealm.run([kadminl, 'addpol', '-maxlife', '10000s', '-minlength', '8',
28*7f2fe78bSCy Schubert           '-minclasses', '2', '-maxfailure', '2',
29*7f2fe78bSCy Schubert           '-failurecountinterval', '90s', '-lockoutduration', '180s',
30*7f2fe78bSCy Schubert           'test-pol'])
31*7f2fe78bSCy Schubertrealm.run([kadminl, 'addpol', '-minlife', '10s', 'minlife-pol'])
32*7f2fe78bSCy Schubertrealm.run([kadminl, 'addpol', 'dict-only-pol'])
33*7f2fe78bSCy Schubertrealm.run([kadminl, 'addprinc', '-pw', 'admin', 'admin'])
34*7f2fe78bSCy Schubertrealm.run([kadminl, 'addprinc', '-pw', 'admin', 'admin/get'])
35*7f2fe78bSCy Schubertrealm.run([kadminl, 'addprinc', '-pw', 'admin', 'admin/modify'])
36*7f2fe78bSCy Schubertrealm.run([kadminl, 'addprinc', '-pw', 'admin', 'admin/delete'])
37*7f2fe78bSCy Schubertrealm.run([kadminl, 'addprinc', '-pw', 'admin', 'admin/add'])
38*7f2fe78bSCy Schubertrealm.run([kadminl, 'addprinc', '-pw', 'admin', 'admin/rename'])
39*7f2fe78bSCy Schubertrealm.run([kadminl, 'addprinc', '-pw', 'admin', 'admin/none'])
40*7f2fe78bSCy Schubertrealm.run([kadminl, 'addprinc', '-pw', 'us3r', '-policy', 'minlife-pol',
41*7f2fe78bSCy Schubert           'user'])
42*7f2fe78bSCy Schubert
43*7f2fe78bSCy Schubertrealm.run(['./t_kadm5srv', 'srv'])
44*7f2fe78bSCy Schubertrealm.run(['./t_kadm5clnt', 'clnt'])
45*7f2fe78bSCy Schubertsuccess('kadm5 API tests')
46