From: Zoltán Felleg Date: Thu, 13 Mar 2025 19:37:24 +0000 (+0100) Subject: Updated fdc.in (added printpwdexpiration.py). X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=a629c0de08bef0404af35a29624250dd60ac5e0b;p=user-lxc.git Updated fdc.in (added printpwdexpiration.py). --- diff --git a/sources/fdc.in/c3d/postinstall/install-data/usr/local/bin/mailpwdexpiration.py b/sources/fdc.in/c3d/postinstall/install-data/usr/local/bin/mailpwdexpiration.py index a90fb4b..3a4c5a7 100755 --- a/sources/fdc.in/c3d/postinstall/install-data/usr/local/bin/mailpwdexpiration.py +++ b/sources/fdc.in/c3d/postinstall/install-data/usr/local/bin/mailpwdexpiration.py @@ -93,8 +93,6 @@ if __name__ == '__main__': rounded_expiration_days = int(expiration_days - 0.5) else: rounded_expiration_days = int(expiration_days + 0.5) - #print(uid, rounded_expiration_days) - #continue if rounded_expiration_days in PWD_EXPIRED_DAYS: send_mail('ERROR', rounded_expiration_days, uid, email_address) elif rounded_expiration_days in PWD_EXPIRING_DAYS: diff --git a/sources/fdc.in/c3d/postinstall/install-data/usr/local/bin/printpwdexpiration.py b/sources/fdc.in/c3d/postinstall/install-data/usr/local/bin/printpwdexpiration.py new file mode 100755 index 0000000..3ea4fc5 --- /dev/null +++ b/sources/fdc.in/c3d/postinstall/install-data/usr/local/bin/printpwdexpiration.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python + + +import ldap +import time + + +LDAP_URI = 'ldaps://fds.useribm.hu' +USERS_BASE = 'ou=people,dc=user,dc=hu' + + +PWD_MAX_AGE = 365 * 24 * 60 * 60 + + +if __name__ == '__main__': + + ldap_object = ldap.initialize(LDAP_URI) + + search_id = ldap_object.search(USERS_BASE, + ldap.SCOPE_SUBTREE, + attrlist=['uid', + 'pwdUpdateTime']) + (search_result_type, search_result_data) = ldap_object.result() + + current_ts = time.mktime(time.gmtime()) + for item in search_result_data: + (dn, values) = item + if 'pwdUpdateTime' in values: + uid = values['uid'][0].decode('utf-8') + pwd_update_time = values['pwdUpdateTime'][0].decode('utf-8') + pwd_update_ts = time.mktime(time.strptime(pwd_update_time, + '%Y%m%d%H%M%S%z')) + expiration_seconds = PWD_MAX_AGE - (current_ts - pwd_update_ts) + expiration_days = expiration_seconds / (24 * 60 * 60) + if expiration_days < 0: + rounded_expiration_days = int(expiration_days - 0.5) + else: + rounded_expiration_days = int(expiration_days + 0.5) + print(uid, rounded_expiration_days) diff --git a/sources/fdc.in/c3d/postinstall/install-data/var/www/htdocs.80/index.xhtml b/sources/fdc.in/c3d/postinstall/install-data/var/www/htdocs.80/index.xhtml index ac9eef7..4592e20 100644 --- a/sources/fdc.in/c3d/postinstall/install-data/var/www/htdocs.80/index.xhtml +++ b/sources/fdc.in/c3d/postinstall/install-data/var/www/htdocs.80/index.xhtml @@ -17,6 +17,11 @@

Új jelszó mégegyszer:

+
+

Az új jelszó a következő követelményeknek kell megfeleljen:

+

1. legalább 14 karakter hosszú kell legyen

+

2. kell benne lennie kisbetűnek, nagybetűnek, számnak, és egy speciális karakternek

+

3. nem lehet benne a loginneved semmilyen formában

diff --git a/sources/fdc.in/c3d/postinstall/install-data/var/www/wsgi/passwordchange.wsgi b/sources/fdc.in/c3d/postinstall/install-data/var/www/wsgi/passwordchange.wsgi index 4d642cb..fdd1382 100644 --- a/sources/fdc.in/c3d/postinstall/install-data/var/www/wsgi/passwordchange.wsgi +++ b/sources/fdc.in/c3d/postinstall/install-data/var/www/wsgi/passwordchange.wsgi @@ -31,7 +31,12 @@ error_prologue = """

Az alábbi hiba miatt nem sikerült megváltoztatni a

Ha nem, keresd meg zfelleget.

(Akinek persze az lesz az első kérdése, hogy mi volt a hibaüzenet utolsó sora, úgyhogy azt vagy mentsd el/írd le, - vagy hagyd nyitva ezt a böngészőablakot.)

+ vagy hagyd nyitva ezt a böngészőablakot.)

+

A két leggyakoribb hiba a következő:

+
"""
 
 error_epilogue = """