Contents of /alx-src/branches/alxconf-060/functions/config_auth.sh
Parent Directory | Revision Log
Revision 336 -
(show annotations)
(download)
(as text)
Thu Sep 22 22:11:43 2005 UTC (19 years ago) by niro
Original Path: alx-src/trunk/alxconfig-ng/functions/config_auth.sh
File MIME type: application/x-sh
File size: 2059 byte(s)
Thu Sep 22 22:11:43 2005 UTC (19 years ago) by niro
Original Path: alx-src/trunk/alxconfig-ng/functions/config_auth.sh
File MIME type: application/x-sh
File size: 2059 byte(s)
using now md5crypt passwd, with help of openssl, theoretically the perl dependency isn't needed anymore.. will check that
1 | # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_auth.sh,v 1.6 2005-09-22 22:11:43 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 $(openssl passwd -1 ${ALX_AUTH_SHELL_PW}) root |
34 | #usermod -p $(perl -e "printf(crypt('${ALX_AUTH_SHELL_PW}','AD'))") root |
35 | |
36 | [ -n "${ALX_AUTH_STATION_PW}" ] && \ |
37 | usermod -p $(openssl passwd -1 ${ALX_AUTH_SHELL_PW}) ${ALX_UNPRIV_USER} |
38 | #usermod -p $(perl -e "printf(crypt('${ALX_AUTH_SHELL_PW}','AD'))") ${ALX_UNPRIV_USER} |
39 | |
40 | if [ -n "${ALX_AUTH_SAMBA_PW}" ] |
41 | then |
42 | # >smb3 smbpasswd -a user password does not work anymore |
43 | if [[ $(smbd --version | cut -d' ' -f2) > 2.999 ]] |
44 | then |
45 | smbpasswd -a root -s << EOF |
46 | ${ALX_AUTH_SAMBA_PW} |
47 | ${ALX_AUTH_SAMBA_PW} |
48 | EOF |
49 | else |
50 | smbpasswd -a root ${ALX_AUTH_SAMBA_PW} |
51 | fi |
52 | fi |
53 | |
54 | # vnc passwd (min 6 chars) |
55 | if [ -n "${ALX_AUTH_VNC_PW}" ] |
56 | then |
57 | # pipe it 2x; 1st for new pw, 2nd to validate |
58 | HOME=/root vncpasswd &> /dev/null << EOF |
59 | ${ALX_AUTH_VNC_PW} |
60 | ${ALX_AUTH_VNC_PW} |
61 | EOF |
62 | fi |
63 | # unset vars |
64 | unset ALX_AUTH_SHELL_PW |
65 | unset ALX_AUTH_VNC_PW |
66 | unset ALX_AUTH_SAMBA_PW |
67 | unset ALX_AUTH_STATION_PW |
68 | } |
69 |