Fix ipa-dns-install

When DNS plugin is installed via ipa-dns-install and user has a valid
Kerberos ticket at the time, the DNS installation is corrupt and named
won't start, reporting Preauthentication error.

When the non-DM identity is used for authentication, krbprincipalkey
attribute in DNS service LDAP record is not created, thus leading
to the error. This patch makes sure that authentication with Directory
Manager password is used every time.

https://fedorahosted.org/freeipa/ticket/1483
This commit is contained in:
Martin Kosek 2011-07-15 09:00:20 +02:00
parent 881df73568
commit aece880d8f

View File

@ -145,25 +145,19 @@ def main():
print "" print ""
# Create a BIND instance # Create a BIND instance
bind = bindinstance.BindInstance(fstore, options.dm_password) if options.unattended and not options.dm_password:
sys.exit("\nIn unattended mode you need to provide at least the -p option")
valid_password = False dm_password = options.dm_password or read_password("Directory Manager",
while not valid_password: confirm=False, validate=False)
# try the connection bind = bindinstance.BindInstance(fstore, dm_password)
try:
bind.ldap_connect() # try the connection
bind.ldap_disconnect() try:
valid_password = True bind.ldap_connect()
except ldap.LOCAL_ERROR, e: bind.ldap_disconnect()
if not bind.dm_password: except ldap.INVALID_CREDENTIALS, e:
if options.unattended: sys.exit("Password is not valid!")
sys.exit("\nIn unattended mode you need to provide at least the -p option")
else:
bind.dm_password = read_password("Directory Manager", confirm=False, validate=False)
except ldap.INVALID_CREDENTIALS, e:
if options.unattended:
sys.exit("\nPassword is not valid!")
bind.dm_password = read_password("Directory Manager", confirm=False, validate=False)
if bind.dm_password: if bind.dm_password:
api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw=bind.dm_password) api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw=bind.dm_password)