Annotation of /alx-src/branches/alxconf-060/functions/config_auth.sh
Parent Directory | Revision Log
Revision 1969 -
(hide annotations)
(download)
(as text)
Sat May 7 11:00:49 2011 UTC (13 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 1070 byte(s)
Sat May 7 11:00:49 2011 UTC (13 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 1070 byte(s)
-dropped samba support
1 | niro | 1969 | # $Id$ |
2 | niro | 245 | # configures the system authentification via mysql db settings |
3 | |||
4 | get_auth_settings() | ||
5 | { | ||
6 | local x i all count | ||
7 | |||
8 | niro | 329 | # get settings from database |
9 | niro | 342 | 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 | niro | 245 | |
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 | niro | 329 | # first of all get the vars |
21 | niro | 245 | get_auth_settings |
22 | |||
23 | [ -n "${ALX_AUTH_SHELL_PW}" ] && \ | ||
24 | niro | 336 | usermod -p $(openssl passwd -1 ${ALX_AUTH_SHELL_PW}) root |
25 | niro | 245 | |
26 | [ -n "${ALX_AUTH_STATION_PW}" ] && \ | ||
27 | niro | 336 | usermod -p $(openssl passwd -1 ${ALX_AUTH_SHELL_PW}) ${ALX_UNPRIV_USER} |
28 | niro | 245 | |
29 | niro | 329 | # 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 | niro | 330 | HOME=/root vncpasswd &> /dev/null << EOF |
34 | niro | 329 | ${ALX_AUTH_VNC_PW} |
35 | ${ALX_AUTH_VNC_PW} | ||
36 | EOF | ||
37 | fi | ||
38 | niro | 342 | |
39 | niro | 245 | # unset vars |
40 | unset ALX_AUTH_SHELL_PW | ||
41 | unset ALX_AUTH_VNC_PW | ||
42 | unset ALX_AUTH_STATION_PW | ||
43 | } |