Update autoremakessh

This commit is contained in:
2026-05-19 19:59:30 -04:00
parent b978da8093
commit d330400475

View File

@@ -4,33 +4,12 @@ FB="\e[1m"
CG="\e[38;5;40m"
CR="\e[38;5;9m"
CY="\033[38;5;226m"
config="/opt/autoremakessh/client/defaultconfig"
echo ""
echo "AutoremakeSSH Version 20260410-0"
echo "© 2026 Franscobec - AGPLv3 License"
echo "https://git.franscorack.com/Franscobec/AutoremakeSSH/src/branch/main/"
echo ""
if [[ $1 = "--server" ]]; then
echo test
elif [[ $1 = "-h" ]]; then
echo "Usage:"
echo "autoremakessh [MODE] [OPTIONS]
echo ""
echo "Possible modes:"
echo "Default (No Arg) - Client mode"
echo "--server - Server mode
echo "Possible Options:"
echo "-c [FILE] - Configuration file to use (Default /opt/autoremakessh/client/defaultconfig)"
echo "-r - Resets .ssh folder of the selected user in the active config"
echo "-h - Display this message"
else
echo test
fi
### BEGIN FUNCTION BLOCK
verifydefaultconfigpresence(){
if [[ -f "$config" = "/opt/autoremakessh/client/defaultconfig" ]]; then
if [ "$config" = "/opt/autoremakessh/client/defaultconfig" ]; then
if [ ! -f /opt/autoremakessh/client/defaultconfig ]; then
echo -e ${CR}No default config found! Use -h argument for help.${NF}
return 1
@@ -43,12 +22,32 @@ if [ ! -f $config ]; then
echo -e ${CR}Invalid config file location or permissions${NF}
return 1
fi
source $config
if [ "$privkey" = "" ]; then
echo -e "${CR}'privkey' value cannot be empty! Exiting!"
return 1
fi
if [ "$pubkey" = "" ]; then
echo -e "${CR}'pubkey' value cannot be empty! Exiting!"
return 1
fi
if [ "$checksumdir" = "" ]; then
echo -e "${CR}'checksumdir' value cannot be empty! Exiting!"
return 1
fi
if [[ "$disablechecksums" != "0" && "$disablechecksums" != "1" ]]; then
echo -e "${CR}Invalid value for option 'disablechecksums'. Exiting!"
return 1
fi
if [[ "$insecure" != "0" && "$insecure" != "1" ]]; then
echo -e "${CR}Invalid value for option 'insecure'. Exiting!"
return 1
fi
}
guardband() {
if [ $? -ne 0 ]; then
echo -e "${CR}Script Exited with an Error.${NF}"
echo -e "${CR}Script Exited with an error.${NF}"
exit 1
fi
}
@@ -66,7 +65,7 @@ fi
}
checksums(){
if [[ $disablechecksums = "0" ]]; then
if [ "$disablechecksums" = "0" ]; then
serversidePUB=$(wget $server/$checksumdir/$priv -q -O -)
serversidePRIV=$(wget $server/$checksumdir/$pub -q -O -)
else
@@ -154,3 +153,34 @@ echo -e "${CR}${FB}@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
sleep 30
exit 1
}
### END FUNCTION BLOCK
echo ""
echo "AutoremakeSSH Version 20260410-0"
echo "© 2026 Franscobec - AGPLv3 License"
echo "https://git.franscorack.com/Franscobec/AutoremakeSSH/src/branch/main/"
echo ""
if [[ $1 = "--server" ]]; then
echo -e "${CR}Feature not yet implemented in this release${NF}"
elif [[ $1 = "-h" ]]; then
echo ""
echo "Usage:"
echo "autoremakessh [MODE] [OPTIONS]"
echo ""
echo "Possible modes:"
echo "Default (No Arg) - Client mode"
echo "--server - Server mode"
echo ""
echo "Possible Options:"
echo "-c [FILE] - Configuration file to use (Default /opt/autoremakessh/client/defaultconfig)"
echo "-h - Display this message"
else
verifydefaultconfigpresence
guardband
verifyconfigvalidity
guardband
verifyserver
fi