diff options
Diffstat (limited to 'selftest/target')
-rw-r--r-- | selftest/target/samba.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/selftest/target/samba.py b/selftest/target/samba.py index 5e652a3528..025dbaeed8 100644 --- a/selftest/target/samba.py +++ b/selftest/target/samba.py @@ -22,3 +22,35 @@ def bindir_path(binary_mapping, bindir, path): if os.path.isfile(valpath): return valpath return path + + +def mk_realms_stanza(realm, dnsname, domain, kdc_ipv4): + """Create a realms stanza for use in a krb5.conf file. + + :param realm: Real name + :param dnsname: DNS name matching the realm + :param domain: Domain name + :param kdc_ipv4: IPv4 address of the KDC + :return: String with stanza + """ + return """\ + %(realm)s = { + kdc = %(kdc_ipv4)s:88 + admin_server = %(kdc_ipv4)s:88 + default_domain = %(dnsname)s + } + %(dnsname)s = { + kdc = %(kdc_ipv4)s:88 + admin_server = %(kdc_ipv4)s:88 + default_domain = %(dnsname)s + } + %(domain)s = { + kdc = %(kdc_ipv4)s:88 + admin_server = %(kdc_ipv4)s:88 + default_domain = %(dnsname)s + } + +""" % { + "kdc_ipv4": kdc_ipv4, "dnsname": dnsname, "realm": realm, "domain": domain} + + |