Contents of /alx-src/tags/alxconf-0_6_0-rc5/functions/config_auth.sh
Parent Directory | Revision Log
Revision 342 -
(show annotations)
(download)
(as text)
Sun Oct 9 21:30:41 2005 UTC (18 years, 11 months ago) by niro
Original Path: alx-src/trunk/alxconfig-ng/functions/config_auth.sh
File MIME type: application/x-sh
File size: 1613 byte(s)
Sun Oct 9 21:30:41 2005 UTC (18 years, 11 months ago) by niro
Original Path: alx-src/trunk/alxconfig-ng/functions/config_auth.sh
File MIME type: application/x-sh
File size: 1613 byte(s)
- fixed whitespaces - using now mysqldo from mysqlfunctions
1 | # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_auth.sh,v 1.7 2005-10-09 21:28:28 niro Exp $ |
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_SAMBA_PW=$(mysqldo "select samba from client_auth where serial='${ALX_SERIAL}'") |
12 | ALX_AUTH_STATION_PW=$(mysqldo "select station from client_auth where serial='${ALX_SERIAL}'") |
13 | |
14 | export ALX_AUTH_SHELL_PW |
15 | export ALX_AUTH_VNC_PW |
16 | export ALX_AUTH_SAMBA_PW |
17 | export ALX_AUTH_STATION_PW |
18 | } |
19 | |
20 | config_auth() |
21 | { |
22 | # first of all get the vars |
23 | get_auth_settings |
24 | |
25 | [ -n "${ALX_AUTH_SHELL_PW}" ] && \ |
26 | usermod -p $(openssl passwd -1 ${ALX_AUTH_SHELL_PW}) root |
27 | |
28 | [ -n "${ALX_AUTH_STATION_PW}" ] && \ |
29 | usermod -p $(openssl passwd -1 ${ALX_AUTH_SHELL_PW}) ${ALX_UNPRIV_USER} |
30 | |
31 | if [ -n "${ALX_AUTH_SAMBA_PW}" ] |
32 | then |
33 | # >smb3 smbpasswd -a user password does not work anymore |
34 | if [[ $(smbd --version | cut -d' ' -f2) > 2.999 ]] |
35 | then |
36 | smbpasswd -a root -s << EOF |
37 | ${ALX_AUTH_SAMBA_PW} |
38 | ${ALX_AUTH_SAMBA_PW} |
39 | EOF |
40 | else |
41 | smbpasswd -a root ${ALX_AUTH_SAMBA_PW} |
42 | fi |
43 | fi |
44 | |
45 | # vnc passwd (min 6 chars) |
46 | if [ -n "${ALX_AUTH_VNC_PW}" ] |
47 | then |
48 | # pipe it 2x; 1st for new pw, 2nd to validate |
49 | HOME=/root vncpasswd &> /dev/null << EOF |
50 | ${ALX_AUTH_VNC_PW} |
51 | ${ALX_AUTH_VNC_PW} |
52 | EOF |
53 | fi |
54 | |
55 | # unset vars |
56 | unset ALX_AUTH_SHELL_PW |
57 | unset ALX_AUTH_VNC_PW |
58 | unset ALX_AUTH_SAMBA_PW |
59 | unset ALX_AUTH_STATION_PW |
60 | } |