From c049b14dc19c01393d6837532e5bf4f2faeb4bbe Mon Sep 17 00:00:00 2001 From: Giampaolo Lauria Date: Tue, 28 Jun 2011 12:19:08 -0400 Subject: samba-tool: moved export to domain dumpkeys This is part of the samba-tool work to fit the object-action model Signed-off-by: Andrew Tridgell --- source4/scripting/python/samba/netcmd/domain.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'source4/scripting/python') diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py index e021694ea6..d13f87e798 100644 --- a/source4/scripting/python/samba/netcmd/domain.py +++ b/source4/scripting/python/samba/netcmd/domain.py @@ -27,6 +27,7 @@ import samba.getopt as options import ldb import os from samba import Ldb +from samba.net import Net from samba.auth import system_session from samba.samdb import SamDB from samba.dcerpc.samr import DOMAIN_PASSWORD_COMPLEX, DOMAIN_PASSWORD_STORE_CLEARTEXT @@ -47,6 +48,27 @@ from samba.dsdb import ( +class cmd_domain_dumpkeys(Command): + """Dumps kerberos keys of the domain into a keytab""" + synopsis = "%prog domain dumpkeys " + + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + + takes_options = [ + ] + + takes_args = ["keytab"] + + def run(self, keytab, credopts=None, sambaopts=None, versionopts=None): + lp = sambaopts.get_loadparm() + net = Net(None, lp, server=credopts.ipaddress) + net.export_keytab(keytab=keytab) + + class cmd_domain_level(Command): """Raises domain and forest function levels""" @@ -444,6 +466,7 @@ class cmd_domain(SuperCommand): """Domain management""" subcommands = {} + subcommands["dumpkeys"] = cmd_domain_dumpkeys() subcommands["level"] = cmd_domain_level() subcommands["machinepassword"] = cmd_domain_machinepassword() subcommands["passwordsettings"] = cmd_domain_passwordsettings() -- cgit