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 3484 by niro, Mon Apr 16 08:45:02 2012 UTC revision 3485 by niro, Mon Apr 16 08:46:22 2012 UTC
# Line 18  gen_keys() Line 18  gen_keys()
18    
19  config_ssh_auth()  config_ssh_auth()
20  {  {
21   local PUB_KEY_SERVER   local pub_key_server
22   local ID   local id
23   local pubkey   local pubkey
24   local CONFIG   local CONFIG
25    
# Line 30  config_ssh_auth() Line 30  config_ssh_auth()
30   pubkey="$(dropbearkey -y -f /etc/dropbear/dropbear_rsa_host_key | sed -n '2p')"   pubkey="$(dropbearkey -y -f /etc/dropbear/dropbear_rsa_host_key | sed -n '2p')"
31    
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 [[ ! -z ${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   CONFIG="$HOME/.ssh/authorized_keys"   CONFIG="$HOME/.ssh/authorized_keys"
41   clearconfig   clearconfig
42   addconfig "${PUB_KEY_SERVER}"   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 [[ ! -z ${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.3484  
changed lines
  Added in v.3485