first commit

This commit is contained in:
Roy
2025-06-23 21:19:51 +02:00
commit a4f9ea11f3
69 changed files with 4857 additions and 0 deletions

60
WsConfman/confman/managemnt.sh Executable file
View File

@ -0,0 +1,60 @@
#!/bin/bash
#(c) Roy Cohen 12/06/2017 :roy@wondercohen.nl
#original script :My own work
#objective :Linux workstation configration manger
#last update :
#version
#Varibles
CLIENT_ARR=( `sudo tail -50 /var/log/secure | grep "Did not receive identification string from" |cut -d " " -f12| sort | uniq` )
CLIENT_PATH="$HOME/confman/hostlist/"
CLIENT=(`ls $CLIENT_PATH`)
# Functions
function add_client {
#Check if the client is known and add the cilent if it is not known in the system
for client in "${CLIENT_ARR[@]}"; do
if [ -f $CLIENT_PATH$client ] ; then
echo "$CLIENT_PATH$client already exists"
else
echo "" > $CLIENT_PATH$client
fi
done
}
function add_ssh_ECDSA {
#Check if the client is known and add the ssh ECDSA key fingerprint to ~/.ssh/known_hosts
for client in "${CLIENT[@]}"; do
grep "$client" $HOME/.ssh/known_hosts > /dev/null
if [ $? -eq 0 ] ; then
echo " $client already known at ~/.ssh/known_hosts"
else
ssh-keyscan $client >> ~/.ssh/known_hosts
fi
done
}
#ssh root@$CLIENT "md5sum /etc/ssh/sshd_config"
#Check if first_start.sh as run on the client, if not than copy the first_start.sh to the client and run it
function first_start {
#FIST_START=`head -1 $CLIENT_PATH$CLIENT`
for cilent in "${CLIENT[@]}"; do
head -1 $CLIENT_PATH$cilent | grep first_start > /dev/null
if [ $? -eq 0 ] ; then
echo "$cilent has allready run first_start"
else
scp ~/confman/scripts/first_start.sh root@$cilent:/root && echo "first_start" > $CLIENT_PATH$cilent
ssh root@$cilent '/root/first_start.sh' >> $CLIENT_PATH$cilent && ssh root@$cilent 'rm /root/first_start.sh'
fi
done
}
#call funcions
add_client
add_ssh_ECDSA
first_start