summaryrefslogtreecommitdiffstats
path: root/ipaserver/plugins/host.py
diff options
context:
space:
mode:
authorPetr Spacek <pspacek@redhat.com>2016-12-21 15:07:34 +0100
committerMartin Basti <mbasti@redhat.com>2017-01-06 09:26:56 +0100
commitfb7c111ac13510609e2cba14ecf88cd2ed291a4b (patch)
tree3c963ca45514bbd66706a27175726a19a9f87713 /ipaserver/plugins/host.py
parent8db5b277a079fdfe5efbd7d49311f14489cee0e8 (diff)
ipa_generate_password algorithm change
A change to the algorithm that generates random passwords for multiple purposes throught IPA. This spells out the need to assess password strength by the entropy it contains rather than its length. This new password generation should also be compatible with the NSS implementation of password requirements in FIPS environment so that newly created databases won't fail with wrong authentication. https://fedorahosted.org/freeipa/ticket/5695 Reviewed-By: Martin Basti <mbasti@redhat.com> Reviewed-By: Petr Spacek <pspacek@redhat.com>
Diffstat (limited to 'ipaserver/plugins/host.py')
-rw-r--r--ipaserver/plugins/host.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/ipaserver/plugins/host.py b/ipaserver/plugins/host.py
index 957a1edcf..58e711f34 100644
--- a/ipaserver/plugins/host.py
+++ b/ipaserver/plugins/host.py
@@ -21,7 +21,6 @@
from __future__ import absolute_import
import dns.resolver
-import string
import six
@@ -62,7 +61,7 @@ from ipalib.util import (normalize_sshpubkey, validate_sshpubkey_no_options,
from ipapython.ipautil import (
ipa_generate_password,
CheckedIPAddress,
- GEN_TMP_PWD_LEN
+ TMP_PWD_ENTROPY_BITS
)
from ipapython.dnsutil import DNSName
from ipapython.ssh import SSHPublicKey
@@ -136,10 +135,6 @@ EXAMPLES:
register = Registry()
-# Characters to be used by random password generator
-# The set was chosen to avoid the need for escaping the characters by user
-host_pwd_chars = string.digits + string.ascii_letters + '_,.@+-='
-
def remove_ptr_rec(ipaddr, fqdn):
"""
@@ -688,7 +683,7 @@ class host_add(LDAPCreate):
entry_attrs['objectclass'].remove('krbprincipal')
if options.get('random'):
entry_attrs['userpassword'] = ipa_generate_password(
- characters=host_pwd_chars, pwd_len=GEN_TMP_PWD_LEN)
+ entropy_bits=TMP_PWD_ENTROPY_BITS)
# save the password so it can be displayed in post_callback
setattr(context, 'randompassword', entry_attrs['userpassword'])
certs = options.get('usercertificate', [])
@@ -915,7 +910,8 @@ class host_mod(LDAPUpdate):
entry_attrs['usercertificate'] = certs_der
if options.get('random'):
- entry_attrs['userpassword'] = ipa_generate_password(characters=host_pwd_chars)
+ entry_attrs['userpassword'] = ipa_generate_password(
+ entropy_bits=TMP_PWD_ENTROPY_BITS)
setattr(context, 'randompassword', entry_attrs['userpassword'])
if 'macaddress' in entry_attrs: