mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Compare commits
5 commits
dev
...
debian/4.0
Author | SHA1 | Date | |
---|---|---|---|
|
4089ffbbcf | ||
|
9b1e85246a | ||
|
0c78374ed4 | ||
|
e49a47c7f5 | ||
|
ac83b10f05 |
5 changed files with 31 additions and 30 deletions
14
debian/changelog
vendored
14
debian/changelog
vendored
|
@ -1,3 +1,17 @@
|
||||||
|
moulinette (4.0.2~beta) testing; urgency=low
|
||||||
|
|
||||||
|
- Bump version number for beta release
|
||||||
|
|
||||||
|
-- Alexandre Aubin <alex.aubin@mailoo.org> Fri, 19 Jun 2020 15:33:29 +0200
|
||||||
|
|
||||||
|
moulinette (4.0.1~alpha) testing; urgency=low
|
||||||
|
|
||||||
|
- [fix] Get rid of legacy code which breaks postinstall on buster for some reason (ac83b10f)
|
||||||
|
- [fix] Remove legacy Breaks and Replaces (e49a47c7)
|
||||||
|
- [fix] Let's hash the password like we do in core during tests (0c78374e)
|
||||||
|
|
||||||
|
-- Alexandre Aubin <alex.aubin@mailoo.org> Fri, 05 Jun 2020 17:32:35 +0200
|
||||||
|
|
||||||
moulinette (3.8.1.2) stable; urgency=low
|
moulinette (3.8.1.2) stable; urgency=low
|
||||||
|
|
||||||
- [fix] locale parsing in some edge case
|
- [fix] locale parsing in some edge case
|
||||||
|
|
2
debian/control
vendored
2
debian/control
vendored
|
@ -18,8 +18,6 @@ Depends: ${misc:Depends}, ${python:Depends},
|
||||||
python-toml,
|
python-toml,
|
||||||
python-psutil,
|
python-psutil,
|
||||||
python-tz
|
python-tz
|
||||||
Replaces: yunohost-cli
|
|
||||||
Breaks: yunohost-cli
|
|
||||||
Description: prototype interfaces with ease in Python
|
Description: prototype interfaces with ease in Python
|
||||||
The moulinette is a Python package that allows one to quickly and
|
The moulinette is a Python package that allows one to quickly and
|
||||||
easily prototype interfaces for your application. Each action can
|
easily prototype interfaces for your application. Each action can
|
||||||
|
|
|
@ -4,9 +4,6 @@
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import random
|
|
||||||
import string
|
|
||||||
import crypt
|
|
||||||
import ldap
|
import ldap
|
||||||
import ldap.sasl
|
import ldap.sasl
|
||||||
import time
|
import time
|
||||||
|
@ -114,30 +111,6 @@ class Authenticator(BaseAuthenticator):
|
||||||
raise MoulinetteError("Not logged in with the expected userdn ?!")
|
raise MoulinetteError("Not logged in with the expected userdn ?!")
|
||||||
else:
|
else:
|
||||||
self.con = con
|
self.con = con
|
||||||
self._ensure_password_uses_strong_hash(password)
|
|
||||||
|
|
||||||
def _ensure_password_uses_strong_hash(self, password):
|
|
||||||
# XXX this has been copy pasted from YunoHost, should we put that into moulinette?
|
|
||||||
def _hash_user_password(password):
|
|
||||||
char_set = (
|
|
||||||
string.ascii_uppercase + string.ascii_lowercase + string.digits + "./"
|
|
||||||
)
|
|
||||||
salt = "".join([random.SystemRandom().choice(char_set) for x in range(16)])
|
|
||||||
salt = "$6$" + salt + "$"
|
|
||||||
return "{CRYPT}" + crypt.crypt(str(password), salt)
|
|
||||||
|
|
||||||
hashed_password = self.search(self.admindn, attrs=["userPassword"])[0]
|
|
||||||
|
|
||||||
# post-install situation, password is not already set
|
|
||||||
if "userPassword" not in hashed_password or not hashed_password["userPassword"]:
|
|
||||||
return
|
|
||||||
|
|
||||||
# we aren't using sha-512 but something else that is weaker, proceed to upgrade
|
|
||||||
if not hashed_password["userPassword"][0].startswith("{CRYPT}$6$"):
|
|
||||||
self.update(
|
|
||||||
"cn=%s" % self.adminuser,
|
|
||||||
{"userPassword": [_hash_user_password(password)]},
|
|
||||||
)
|
|
||||||
|
|
||||||
# Additional LDAP methods
|
# Additional LDAP methods
|
||||||
# TODO: Review these methods
|
# TODO: Review these methods
|
||||||
|
|
|
@ -98,7 +98,22 @@ class LDAPServer:
|
||||||
"posixAccount",
|
"posixAccount",
|
||||||
"simpleSecurityObject",
|
"simpleSecurityObject",
|
||||||
],
|
],
|
||||||
"userPassword": ["yunohost"],
|
"userPassword": [self._hash_user_password("yunohost")],
|
||||||
}
|
}
|
||||||
|
|
||||||
ldap_interface.update("cn=admin", admin_dict)
|
ldap_interface.update("cn=admin", admin_dict)
|
||||||
|
|
||||||
|
|
||||||
|
def _hash_user_password(self, password):
|
||||||
|
"""
|
||||||
|
Copy pasta of what's in yunohost/user.py
|
||||||
|
"""
|
||||||
|
import string
|
||||||
|
import random
|
||||||
|
import crypt
|
||||||
|
|
||||||
|
char_set = string.ascii_uppercase + string.ascii_lowercase + string.digits + "./"
|
||||||
|
salt = ''.join([random.SystemRandom().choice(char_set) for x in range(16)])
|
||||||
|
|
||||||
|
salt = '$6$' + salt + '$'
|
||||||
|
return '{CRYPT}' + crypt.crypt(str(password), salt)
|
||||||
|
|
1
tox.ini
1
tox.ini
|
@ -19,6 +19,7 @@ deps =
|
||||||
gevent-websocket
|
gevent-websocket
|
||||||
bottle >= 0.12
|
bottle >= 0.12
|
||||||
WebTest >= 2.0, < 2.1
|
WebTest >= 2.0, < 2.1
|
||||||
|
python-ldap >= 3.1.0
|
||||||
commands =
|
commands =
|
||||||
pytest {posargs}
|
pytest {posargs}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue