Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 330 - (hide annotations) (download) (as text)
Wed Sep 7 19:14:24 2005 UTC (18 years, 8 months ago) by niro
Original Path: alx-src/trunk/alxconfig-ng/functions/config_auth.sh
File MIME type: application/x-sh
File size: 1923 byte(s)
added HOME=/root as $HOME is not defined on system boot

1 niro 330 # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_auth.sh,v 1.5 2005-09-07 19:14:24 niro Exp $
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 # all arrays:
9 niro 245 # -> session1 session2 ... sessionN
10    
11 niro 329 # get settings from database
12 niro 245 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 niro 329 # first of all get the vars
30 niro 245 get_auth_settings
31    
32     [ -n "${ALX_AUTH_SHELL_PW}" ] && \
33 niro 250 usermod -p $(perl -e "printf(crypt('${ALX_AUTH_SHELL_PW}','AD'))") root
34 niro 245
35     [ -n "${ALX_AUTH_STATION_PW}" ] && \
36 niro 250 usermod -p $(perl -e "printf(crypt('${ALX_AUTH_SHELL_PW}','AD'))") ${ALX_UNPRIV_USER}
37 niro 245
38 niro 302 if [ -n "${ALX_AUTH_SAMBA_PW}" ]
39     then
40     # >smb3 smbpasswd -a user password does not work anymore
41     if [[ $(smbd --version | cut -d' ' -f2) > 2.999 ]]
42     then
43     smbpasswd -a root -s << EOF
44     ${ALX_AUTH_SAMBA_PW}
45     ${ALX_AUTH_SAMBA_PW}
46     EOF
47     else
48     smbpasswd -a root ${ALX_AUTH_SAMBA_PW}
49     fi
50     fi
51 niro 245
52 niro 329 # vnc passwd (min 6 chars)
53     if [ -n "${ALX_AUTH_VNC_PW}" ]
54     then
55     # pipe it 2x; 1st for new pw, 2nd to validate
56 niro 330 HOME=/root vncpasswd &> /dev/null << EOF
57 niro 329 ${ALX_AUTH_VNC_PW}
58     ${ALX_AUTH_VNC_PW}
59     EOF
60     fi
61 niro 245 # unset vars
62     unset ALX_AUTH_SHELL_PW
63     unset ALX_AUTH_VNC_PW
64     unset ALX_AUTH_SAMBA_PW
65     unset ALX_AUTH_STATION_PW
66     }
67 niro 329