Contents of /alx-src/branches/alxconf-060/functions/config_auth.sh
Parent Directory | Revision Log
Revision 1969 -
(show annotations)
(download)
(as text)
Sat May 7 11:00:49 2011 UTC (13 years, 1 month ago) by niro
File MIME type: application/x-sh
File size: 1070 byte(s)
Sat May 7 11:00:49 2011 UTC (13 years, 1 month ago) by niro
File MIME type: application/x-sh
File size: 1070 byte(s)
-dropped samba support
1 | # $Id$ |
2 | # configures the system authentification via mysql db settings |
3 | |
4 | get_auth_settings() |
5 | { |
6 | local x i all count |
7 | |
8 | # get settings from database |
9 | ALX_AUTH_SHELL_PW=$(mysqldo "select shell from client_auth where serial='${ALX_SERIAL}'") |
10 | ALX_AUTH_VNC_PW=$(mysqldo "select vnc from client_auth where serial='${ALX_SERIAL}'") |
11 | ALX_AUTH_STATION_PW=$(mysqldo "select station from client_auth where serial='${ALX_SERIAL}'") |
12 | |
13 | export ALX_AUTH_SHELL_PW |
14 | export ALX_AUTH_VNC_PW |
15 | export ALX_AUTH_STATION_PW |
16 | } |
17 | |
18 | config_auth() |
19 | { |
20 | # first of all get the vars |
21 | get_auth_settings |
22 | |
23 | [ -n "${ALX_AUTH_SHELL_PW}" ] && \ |
24 | usermod -p $(openssl passwd -1 ${ALX_AUTH_SHELL_PW}) root |
25 | |
26 | [ -n "${ALX_AUTH_STATION_PW}" ] && \ |
27 | usermod -p $(openssl passwd -1 ${ALX_AUTH_SHELL_PW}) ${ALX_UNPRIV_USER} |
28 | |
29 | # vnc passwd (min 6 chars) |
30 | if [ -n "${ALX_AUTH_VNC_PW}" ] |
31 | then |
32 | # pipe it 2x; 1st for new pw, 2nd to validate |
33 | HOME=/root vncpasswd &> /dev/null << EOF |
34 | ${ALX_AUTH_VNC_PW} |
35 | ${ALX_AUTH_VNC_PW} |
36 | EOF |
37 | fi |
38 | |
39 | # unset vars |
40 | unset ALX_AUTH_SHELL_PW |
41 | unset ALX_AUTH_VNC_PW |
42 | unset ALX_AUTH_STATION_PW |
43 | } |