Contents of /alx-src/trunk/alxconfig-ng/functions/config_auth.sh
Parent Directory | Revision Log
Revision 245 -
(show annotations)
(download)
(as text)
Wed Apr 13 16:09:25 2005 UTC (19 years, 5 months ago) by niro
File MIME type: application/x-sh
File size: 1499 byte(s)
Wed Apr 13 16:09:25 2005 UTC (19 years, 5 months ago) by niro
File MIME type: application/x-sh
File size: 1499 byte(s)
new; configures system authentification
1 | # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_auth.sh,v 1.1 2005-04-13 16:09:25 niro Exp $ |
2 | # configures the system authentification via mysql db settings |
3 | |
4 | get_auth_settings() |
5 | { |
6 | local x i all count |
7 | |
8 | #all arrays: |
9 | # -> session1 session2 ... sessionN |
10 | |
11 | #get settings from database |
12 | ALX_AUTH_SHELL_PW=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
13 | "select shell from client_auth where serial='${ALX_SERIAL}'") |
14 | ALX_AUTH_VNC_PW=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
15 | "select vnc from client_auth where serial='${ALX_SERIAL}'") |
16 | ALX_AUTH_SAMBA_PW=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
17 | "select samba from client_auth where serial='${ALX_SERIAL}'") |
18 | ALX_AUTH_STATION_PW=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
19 | "select station from client_auth where serial='${ALX_SERIAL}'") |
20 | |
21 | export ALX_AUTH_SHELL_PW |
22 | export ALX_AUTH_VNC_PW |
23 | export ALX_AUTH_SAMBA_PW |
24 | export ALX_AUTH_STATION_PW |
25 | } |
26 | |
27 | config_auth() |
28 | { |
29 | #first of all get the vars |
30 | get_auth_settings |
31 | |
32 | [ -n "${ALX_AUTH_SHELL_PW}" ] && \ |
33 | usermod -p $(perl -e "printf(crypt("${ALX_AUTH_SHELL_PW}","AD"))") root |
34 | |
35 | [ -n "${ALX_AUTH_STATION_PW}" ] && \ |
36 | usermod -p $(perl -e "printf(crypt("${ALX_AUTH_SHELL_PW}","AD"))") ${ALX_UNPRIV_USER} |
37 | |
38 | [ -n "${ALX_AUTH_SAMBA_PW}" ] && \ |
39 | smbpasswd -a root ${ALX_AUTH_SAMBA_PW} |
40 | |
41 | # unset vars |
42 | unset ALX_AUTH_SHELL_PW |
43 | unset ALX_AUTH_VNC_PW |
44 | unset ALX_AUTH_SAMBA_PW |
45 | unset ALX_AUTH_STATION_PW |
46 | } |