Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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