Yo,
Mhh, pas trivial.
Tu dois pouvoir te créer un programme de login, genre "monlogin.py" :
#!/usr/bin/env python
# vim:set fileencoding=utf-8:
from __future__ import print_function
import PAM
import sys, os
from getpass import getpass
def affiche_aide():
print('meuh')
def pam_conv(auth, query_list, userData):
resp = []
for i in range(len(query_list)):
query, type = query_list[i]
if type == PAM.PAM_PROMPT_ECHO_ON:
val = raw_input("Nom d'utilisateur : ")
resp.append((val, 0))
elif type == PAM.PAM_PROMPT_ECHO_OFF:
val = getpass("Mot de passe (ne s'affiche pas) : ")
resp.append((val, 0))
elif type == PAM.PAM_PROMPT_ERROR_MSG or type == PAM.PAM_PROMPT_TEXT_INFO:
print(query)
resp.append(('', 0))
else:
return None
return resp
def try_auth():
affiche_aide()
service = "login"
auth = PAM.pam()
auth.start(service)
auth.set_item(PAM.PAM_CONV, pam_conv)
try:
auth.authenticate()
auth.acct_mgmt()
except PAM.error, resp:
print("Erreur d'authentification : %s" % resp)
except:
print('Erreur interne')
else:
return True,auth.get_item(PAM.PAM_USER)
return False,""
if __name__ == "__main__":
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
auth,login = try_auth()
if auth:
os.execv("/bin/su",["-l", "-", login])
(Nécessite python-pam)
Puis indiquer à getty d'utiliser « monlogin.py » (argument « -l ») dans le « /etc/inittab ».
Après, je ne sais pas ce dont tu as vraiment besoin, et je ne connais rien qui existe déjà et réponde à tes besoins.
Si tu sais coder, tu dois pouvoir modifier ce programme pour faire un truc ncurses joli… Perso je ne sais pas faire, pour le moment
captnfab,
Association Debian-Facile, bépo.
TheDoctor: Your wish is my command… But be careful what you wish for.