3 # Copyright (C) Matthieu Patou <mat@matws.net> 2010
4 # Copyright (C) Andrew Bartlett <abartlet@samba.org> 2015
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 __docformat__
= "restructuredText"
26 # Allow to run from s4 source directory (without installing samba)
27 sys
.path
.insert(0, "bin/python")
29 import samba
.getopt
as options
30 from samba
.credentials
import DONT_USE_KERBEROS
31 from samba
.auth
import system_session
32 from samba
import param
33 from samba
.provision
import find_provision_key_parameters
34 from samba
.upgradehelpers
import (get_paths
,
36 update_krbtgt_account_password
)
38 parser
= optparse
.OptionParser("chgkrbtgtpass [options]")
39 sambaopts
= options
.SambaOptions(parser
)
40 parser
.add_option_group(sambaopts
)
41 parser
.add_option_group(options
.VersionOptions(parser
))
42 credopts
= options
.CredentialsOptions(parser
)
43 parser
.add_option_group(credopts
)
45 opts
= parser
.parse_args()[0]
47 lp
= sambaopts
.get_loadparm()
48 smbconf
= lp
.configfile
49 creds
= credopts
.get_credentials(lp
)
50 creds
.set_kerberos_state(DONT_USE_KERBEROS
)
53 paths
= get_paths(param
, smbconf
=smbconf
)
54 session
= system_session()
56 ldbs
= get_ldbs(paths
, creds
, session
, lp
)
57 ldbs
.startTransactions()
59 update_krbtgt_account_password(ldbs
.sam
)