Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enh] Automatically check for weak password #196

Merged
merged 33 commits into from Nov 4, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
73760c4
[enh] implement password checks with cracklib to detect too weak pass…
julienmalik Mar 3, 2016
0ec81b4
[enh] add python-cracklib to dependencies
julienmalik Mar 3, 2016
cda8bcf
Merge branch 'stretch-unstable' of https://github.com/YunoHost/yunoho…
zamentur Aug 26, 2018
06276a6
[enh] Check password in cli/api
zamentur Aug 27, 2018
0c33ad5
[enh] Validate pwd with Online Pwned List
zamentur Aug 28, 2018
67e8211
[enh] Validate pwd with Online Pwned List
zamentur Aug 28, 2018
783c512
[enh] PasswordValidator without Moulinette
zamentur Aug 28, 2018
536b46e
[enh] Support advice with standalone password.py
zamentur Aug 28, 2018
ca91a9c
[enh] Protect password
zamentur Aug 28, 2018
0a633e7
[enh] Change the way password.py interract with ssowat
zamentur Aug 28, 2018
4a13634
[fix] Bad indentation
zamentur Aug 29, 2018
aac9b78
We aint using that online thing :|
alexAubin Oct 25, 2018
08e1d92
Simplify the 'listed' check
alexAubin Oct 25, 2018
85d3c7d
Moar cleaning
alexAubin Oct 25, 2018
2b00e07
Merge Profile validator into regular validator
alexAubin Oct 25, 2018
3c5ce49
Various changes to try to improve the semantic of everything @.@
alexAubin Oct 25, 2018
55256c1
Merge LoggerPasswordValidator with PasswordValidator
alexAubin Oct 25, 2018
167df05
Not sure to understand the whole logic behind this :/ To me this shou…
alexAubin Oct 25, 2018
9140889
Propagate interface changes everywhere the assertion is used
alexAubin Oct 25, 2018
8a0c450
Those arent used ?
alexAubin Oct 25, 2018
c313084
Consistency with comment in settings.py
alexAubin Oct 25, 2018
2209f75
Raise the level 1 length from 6 to 8 to reduce the gap with level 2
alexAubin Oct 25, 2018
354cd81
Misc cleaning
alexAubin Oct 25, 2018
3196025
To me this doesnt make sense :| Either the password is accepted or it…
alexAubin Oct 25, 2018
5ed1b6d
[fix] Number of char
zamentur Oct 25, 2018
a780ebd
Number of char
alexAubin Oct 25, 2018
4268c0d
Forgot 'self'
alexAubin Oct 26, 2018
ded9b58
Use level 1 as default for everybody
alexAubin Oct 26, 2018
98c0745
Add comment about good pratice for password
alexAubin Oct 26, 2018
5b8c6f4
Merge pull request #567 from YunoHost/cracklib-enh
alexAubin Oct 27, 2018
1ce2025
Cracklib is too nazi, use a simple txt list + grep to search for pass…
alexAubin Oct 31, 2018
f28df13
Merge branch 'cracklib' of https://github.com/YunoHost/yunohost into …
alexAubin Oct 31, 2018
d6053f5
This ain't used anywhere ?
alexAubin Oct 31, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion debian/control
Expand Up @@ -12,7 +12,7 @@ Architecture: all
Depends: ${python:Depends}, ${misc:Depends}
, moulinette (>= 2.3.5.1)
, python-psutil, python-requests, python-dnspython
, python-apt, python-miniupnpc
, python-apt, python-miniupnpc, python-cracklib
, glances
, dnsutils, bind9utils, unzip, git, curl, cron
, ca-certificates, netcat-openbsd, iproute
Expand Down
12 changes: 12 additions & 0 deletions src/yunohost/user.py
Expand Up @@ -32,12 +32,18 @@
import subprocess
import math
import re
import cracklib
alexAubin marked this conversation as resolved.
Show resolved Hide resolved

from moulinette.core import MoulinetteError
from moulinette.utils.log import getActionLogger

logger = getActionLogger('yunohost.user')

def _check_password(password):
try:
cracklib.VeryFascistCheck(password)
except ValueError as e:
raise MoulinetteError(errno.EINVAL, m18n.n('password_too_weak') + " : " + str(e) )

def user_list(auth, fields=None, filter=None, limit=None, offset=None):
"""
Expand Down Expand Up @@ -110,6 +116,9 @@ def user_create(auth, username, firstname, lastname, mail, password,
from yunohost.hook import hook_callback
from yunohost.app import app_ssowatconf

# Ensure sufficiently complex password
_check_password(password)

# Validate uniqueness of username and mail in LDAP
auth.validate_uniqueness({
'uid' : username,
Expand Down Expand Up @@ -291,6 +300,9 @@ def user_update(auth, username, firstname=None, lastname=None, mail=None,
new_attr_dict['cn'] = new_attr_dict['displayName'] = firstname + ' ' + lastname

if change_password:
# Ensure sufficiently complex password
_check_password(change_password)

char_set = string.ascii_uppercase + string.digits
salt = ''.join(random.sample(char_set,8))
salt = '$1$' + salt + '$'
Expand Down