mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Setup Script - Delete key then accept it
This commit is contained in:
@@ -35,29 +35,10 @@ accept_salt_key_local() {
|
||||
|
||||
accept_salt_key_remote() {
|
||||
|
||||
# See if the key is already there. If so nuke it.
|
||||
GETKEYSACCEPTED=$(ssh -v -i /root/.ssh/so.key socore@$MSRV sudo salt-key -l accepted)
|
||||
GETKEYSREJECTED=$(ssh -v -i /root/.ssh/so.key socore@$MSRV sudo salt-key -l rejected)
|
||||
echo "Seeing if the key exists"
|
||||
echo $GETKEYSACCEPTED
|
||||
echo $GETKEYSREJECTED
|
||||
if grep -q $HOSTNAME $GETKEYSACCEPTED; then
|
||||
SKACPT=1
|
||||
else
|
||||
SKACPT=0
|
||||
fi
|
||||
if grep -q $HOSTNAME $GETKEYSREJECTED; then
|
||||
SKRJCT=1
|
||||
else
|
||||
SKRJCT=0
|
||||
fi
|
||||
|
||||
if [ $SKACPT=1 ] || [ $SKRJCT=1 ]; then
|
||||
# Delete the key just in case.
|
||||
ssh -v -i /root/.ssh/so.key socore@$MSRV sudo salt-key -d $HOSTNAME -y
|
||||
else
|
||||
# Accept the key remotely so the device can check in
|
||||
salt-call state.apply ca
|
||||
ssh -v -i /root/.ssh/so.key socore@$MSRV sudo salt-key -a $HOSTNAME -y
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user