Bug 34828 - Provision failed due to password complexity criteria
Provision failed due to password complexity criteria
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Samba4
UCS 4.2
Other Linux
: P5 normal (vote)
: UCS 4.4-0-errata
Assigned To: Fathan Vidjaja
Arvid Requate
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-14 07:19 CEST by Stefan Gohmann
Modified: 2019-05-15 14:52 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 6: Setup Problem: Issue for the setup process
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 3: A User would likely not purchase the product
User Pain: 0.103
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments
1.patch (775 bytes, patch)
2019-02-14 18:23 CET, Arvid Requate
Details | Diff
adminpass.patch (1.64 KB, patch)
2019-02-14 22:49 CET, Arvid Requate
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Gohmann univentionstaff 2014-05-14 07:19:59 CEST
Happened during the installation tests from Philipp (DC Master with Samba 4):

From join.log:

Setting up sam.ldb data
Setting up well known security principals
Setting up sam.ldb users and groups
ERROR(ldb): uncaught exception - 0000052D: Constraint violation - check_password_restrictions: the password does not meet the complexity criteria!
  File "/usr/lib/python2.6/dist-packages/samba/netcmd/__init__.py", line 175, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/samba/netcmd/domain.py", line 401, in run
    use_rfc2307=use_rfc2307, skip_sysvolacl=False)
  File "/usr/lib/python2.6/dist-packages/samba/provision/__init__.py", line 2155, in provision
    skip_sysvolacl=skip_sysvolacl)
  File "/usr/lib/python2.6/dist-packages/samba/provision/__init__.py", line 1757, in provision_fill
    next_rid=next_rid, dc_rid=dc_rid)
  File "/usr/lib/python2.6/dist-packages/samba/provision/__init__.py", line 1436, in fill_samdb
    "KRBTGTPASS_B64": b64encode(krbtgtpass.encode('utf-16-le'))
  File "/usr/lib/python2.6/dist-packages/samba/provision/common.py", line 50, in setup_add_ldif
    ldb.add_ldif(data, controls)
  File "/usr/lib/python2.6/dist-packages/samba/__init__.py", line 224, in add_ldif
    self.add(msg, controls)

This is a little bit strange because we use "pwgen -1 -s -c -n 16" for the password generation at least for the Administrator. Maybe the KRBTGTPASS is generated in a different way?
Comment 1 Arvid Requate univentionstaff 2017-04-20 20:42:00 CEST
There are AD specific complexity criteria, maybe pwgen doesn't always conform to those. Somewhere in samba there is a generator routine that should be used.
Comment 2 Jürn Brodersen univentionstaff 2019-02-14 14:07:51 CET
Happend again on jenkins

The criteria is defined in:
https://github.com/samba-team/samba/blob/v4-7-stable/lib/util/genrand_util.c#L62

The pwgen command in setup-s4.sh can generate password with only uppercase letters and numbers. Such a password does not meet the criteria.

Possible patch:
$(pwgen -1 -s -c -n 16) -> $(pwgen -1 -s -c -n 12)$(pwgen -1 -s -A -n 12)


With 100 tries it took an average of 5306 calls to pwgen to generate a password that fails sambas password criteria.
Comment 3 Jürn Brodersen univentionstaff 2019-02-14 14:11:51 CET
Join script error:

ERROR: Administrator password does not meet the default quality standards
ERROR: Samba4 provision failed, exiting /usr/share/univention-samba4/scripts/setup-s4.sh
Comment 4 Jürn Brodersen univentionstaff 2019-02-14 18:21:54 CET
Notes:
relevant code: setup-s4.sh -> run_samba_domain_provision()

The problem does not seem to be the machine.secret.
I hardcoded  --machinepass="12345678" -> No Problem
and --adminpass="12345678" -> Error

At least to me it looks like adminpass is not the same as the machine.secret
Comment 5 Arvid Requate univentionstaff 2019-02-14 18:23:21 CET
Created attachment 9842 [details]
1.patch

man pwgen:  -n: "at least one number", so your idea could result in 24 digits, theoretically.

The attached patch may fix this.
Comment 6 Arvid Requate univentionstaff 2019-02-14 22:49:52 CET
Created attachment 9843 [details]
adminpass.patch

Yes, Jürn, you may be right, that random password given to the --adminpass option is to weak. I guess we could just drop the option from the script, as samba generates a random one itself in that case.
Comment 7 Fathan Vidjaja univentionstaff 2019-05-07 12:18:45 CEST
I tested and merged the patch above.
Comment 8 Arvid Requate univentionstaff 2019-05-10 00:11:36 CEST
Verified:
* Change review
* Functional test
* Advisory

I also checked, what happend if the /etc/machine.secret ist very simple: On my plain UCS 4.4 test-VM I've adjusted server-password-change to set "univention". After that I've run "univention-app install samba4", and everything worked. So Samba doesn't bail out if /etc/machine.secret accidentally doesn't match AD-specific password complexity criteria.
Comment 9 Arvid Requate univentionstaff 2019-05-15 14:52:11 CEST
<http://errata.software-univention.de/ucs/4.4/106.html>