Magellan Linux

Diff of /alx-src/branches/alxconf-060/functions/config_ssh_auth.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2035 by niro, Sat May 7 11:02:49 2011 UTC revision 2036 by niro, Wed May 11 09:11:25 2011 UTC
# Line 21  config_ssh_auth() Line 21  config_ssh_auth()
21   local PUB_KEY_SERVER   local PUB_KEY_SERVER
22   local ID   local ID
23   local pubkey   local pubkey
24     local CONFIG
25    
26   # generate evtually missing keys   # generate evtually missing keys
27   gen_keys   gen_keys
# Line 31  config_ssh_auth() Line 32  config_ssh_auth()
32   # write the public key of the server to the host system   # write the public key of the server to the host system
33   PUB_KEY_SERVER="$(mysqldo "select public_key from ssh_auth_server where id=1;")"   PUB_KEY_SERVER="$(mysqldo "select public_key from ssh_auth_server where id=1;")"
34    
35   if [ -n "${PUB_KEY_SERVER}" ]   if [[ ! -z ${PUB_KEY_SERVER} ]]
36   then   then
37   HOME=/root   HOME=/root
38   # only if not empty   # only if not empty
39   [ ! -d $HOME/.ssh ] && install -d $HOME/.ssh   [ ! -d $HOME/.ssh ] && install -d $HOME/.ssh
40   echo "${PUB_KEY_SERVER}" > $HOME/.ssh/authorized_keys   CONFIG=$HOME/.ssh/authorized_keys
41     clearconfig
42     addconfig "${PUB_KEY_SERVER}"
43   fi   fi
44    
45   # put the public key of the host into the db   # put the public key of the host into the db
46   ID=$(mysqldo "select serial from ssh_auth_clients where serial=${ALX_SERIAL};")   ID=$(mysqldo "select serial from ssh_auth_clients where serial=${ALX_SERIAL};")
47    
48   if [ -n "${ID}" ]   if [[ ! -z ${ID} ]]
49   then   then
50   # run an update   # run an update
51   mysqldo "update ssh_auth_clients set public_key='${pubkey}' where serial=${ALX_SERIAL};"   mysqldo "update ssh_auth_clients set public_key='${pubkey}' where serial=${ALX_SERIAL};"

Legend:
Removed from v.2035  
changed lines
  Added in v.2036