1 |
# $Id$ |
# $Id$ |
2 |
# configures the system authentification via mysql db settings |
# configures the system authentification via mysql db settings |
3 |
|
|
|
get_auth_settings() |
|
|
{ |
|
|
local x i all count |
|
|
|
|
|
# get settings from database |
|
|
ALX_AUTH_SHELL_PW=$(mysqldo "select shell from client_auth where serial='${ALX_SERIAL}'") |
|
|
ALX_AUTH_VNC_PW=$(mysqldo "select vnc from client_auth where serial='${ALX_SERIAL}'") |
|
|
ALX_AUTH_STATION_PW=$(mysqldo "select station from client_auth where serial='${ALX_SERIAL}'") |
|
|
|
|
|
export ALX_AUTH_SHELL_PW |
|
|
export ALX_AUTH_VNC_PW |
|
|
export ALX_AUTH_STATION_PW |
|
|
} |
|
|
|
|
4 |
config_auth() |
config_auth() |
5 |
{ |
{ |
6 |
# first of all get the vars |
# first of all get the vars |
7 |
get_auth_settings |
evaluate_table client_auth |
8 |
|
|
9 |
if [[ ! -z ${ALX_AUTH_SHELL_PW} ]] |
if [[ ! -z ${client_auth_shell} ]] |
10 |
then |
then |
11 |
( echo "${ALX_AUTH_SHELL_PW}"; sleep 0.1; echo "${ALX_AUTH_SHELL_PW}" ) | passwd root > /dev/null |
( echo "${client_auth_shell}"; sleep 0.1; echo "${client_auth_shell}" ) | passwd root > /dev/null |
12 |
fi |
fi |
13 |
|
|
14 |
if [[ ! -z ${ALX_AUTH_STATION_PW} ]] |
if [[ ! -z ${client_auth_station} ]] |
15 |
then |
then |
16 |
( echo "${ALX_AUTH_STATION_PW}"; sleep 0.1; echo "${ALX_AUTH_STATION_PW}" ) | passwd ${ALX_UNPRIV_USER} > /dev/null |
( echo "${client_auth_station}"; sleep 0.1; echo "${client_auth_station}" ) | passwd ${ALX_UNPRIV_USER} > /dev/null |
17 |
fi |
fi |
18 |
|
|
19 |
# vnc passwd (min 6 chars) |
# vnc passwd (min 6 chars) |
20 |
if [[ ! -z ${ALX_AUTH_VNC_PW} ]] |
if [[ ! -z ${client_auth_vnc} ]] |
21 |
then |
then |
22 |
# pipe it 2x; 1st for new pw, 2nd to validate |
# pipe it 2x; 1st for new pw, 2nd to validate |
23 |
HOME=/root vncpasswd &> /dev/null << EOF |
HOME=/root vncpasswd &> /dev/null << EOF |
24 |
${ALX_AUTH_VNC_PW} |
${client_auth_vnc} |
25 |
${ALX_AUTH_VNC_PW} |
${client_auth_vnc} |
26 |
EOF |
EOF |
27 |
fi |
fi |
|
|
|
|
# unset vars |
|
|
unset ALX_AUTH_SHELL_PW |
|
|
unset ALX_AUTH_VNC_PW |
|
|
unset ALX_AUTH_STATION_PW |
|
28 |
} |
} |