Magellan Linux

Contents of /alx-src/branches/alxconf-060/functions/config_auth.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2023 - (show annotations) (download) (as text)
Tue May 10 16:29:13 2011 UTC (12 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 1152 byte(s)
-busybox compat
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 if [[ ! -z ${ALX_AUTH_SHELL_PW} ]]
24 then
25 ( echo "${ALX_AUTH_SHELL_PW}"; sleep 0.1; echo "${ALX_AUTH_SHELL_PW}" ) | passwd root
26 fi
27
28 if [[ ! -z ${ALX_AUTH_STATION_PW} ]]
29 then
30 ( echo "${ALX_AUTH_STATION_PW}"; sleep 0.1; echo "${ALX_AUTH_STATION_PW}" ) | passwd ${ALX_UNPRIV_USER}
31 fi
32
33 # vnc passwd (min 6 chars)
34 if [[ ! -z ${ALX_AUTH_VNC_PW} ]]
35 then
36 # pipe it 2x; 1st for new pw, 2nd to validate
37 HOME=/root vncpasswd &> /dev/null << EOF
38 ${ALX_AUTH_VNC_PW}
39 ${ALX_AUTH_VNC_PW}
40 EOF
41 fi
42
43 # unset vars
44 unset ALX_AUTH_SHELL_PW
45 unset ALX_AUTH_VNC_PW
46 unset ALX_AUTH_STATION_PW
47 }