Added option to generate certificate on remote machine (ks-up*)
This commit is contained in:
parent
2ce46a33a4
commit
1682255e62
38
src/ks-upa
38
src/ks-upa
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# ks-upa (ks-tools) - Upload audio file(s) to server with scp or rsync #
|
# ks-upa (ks-tools) - Upload audio file(s) to server with scp or rsync #
|
||||||
# Date: 13-02-2023 #
|
# Date: 11-03-2023 #
|
||||||
# Author: q3aql #
|
# Author: q3aql #
|
||||||
# Contact: q3aql@duck.com #
|
# Contact: q3aql@duck.com #
|
||||||
########################################################################
|
########################################################################
|
||||||
VERSION="8.4-dev"
|
VERSION="8.4-dev"
|
||||||
M_DATE="130223"
|
M_DATE="110323"
|
||||||
|
|
||||||
# Global parameters.
|
# Global parameters.
|
||||||
dirTemp="/tmp"
|
dirTemp="/tmp"
|
||||||
|
@ -397,6 +397,32 @@ function decrypt_kstools() {
|
||||||
echo ${pass_decrypt}
|
echo ${pass_decrypt}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to generate certificate on remote machine
|
||||||
|
function gen_pem_ssh() {
|
||||||
|
userhost="${USER}"
|
||||||
|
name_host="${HOSTNAME}"
|
||||||
|
echo "" && echo "* Generating .pem file to connect to this machine (${userhost})."
|
||||||
|
ssh-keygen << EOF
|
||||||
|
${userhost}
|
||||||
|
EOF
|
||||||
|
mv ${userhost} ${userhost}-${name_host}.pem
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
chmod 700 ~/.ssh
|
||||||
|
touch ~/.ssh/authorized_keys
|
||||||
|
chmod 600 ~/.ssh/authorized_keys
|
||||||
|
echo "* Adding entry in the file ~/.ssh/authorized_keys"
|
||||||
|
cat ${userhost}.pub >> ~/.ssh/authorized_keys
|
||||||
|
rm -rf ${userhost}.pub
|
||||||
|
echo ""
|
||||||
|
echo "+ Copy the ${userhost}-${name_host}.pem file to your computer to connect to this machine."
|
||||||
|
if [ -f /usr/bin/puttygen ] ; then
|
||||||
|
puttygen ${userhost}-${name_host}.pem -o ${userhost}-${name_host}.ppk -O private
|
||||||
|
echo "+ Copy the ${userhost}-${name_host}.ppk file to your computer to connect to this machine."
|
||||||
|
fi
|
||||||
|
echo "+ Connect: ssh -i ${userhost}-${name_host}.pem ${userhost}@${name_host}"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
# Function to show config
|
# Function to show config
|
||||||
function showConfig() {
|
function showConfig() {
|
||||||
configAvailable=0
|
configAvailable=0
|
||||||
|
@ -649,6 +675,7 @@ function showHelp() {
|
||||||
echo " $ ks-upa -r - Remove configuration"
|
echo " $ ks-upa -r - Remove configuration"
|
||||||
echo " $ ks-upa -c - Show configuration"
|
echo " $ ks-upa -c - Show configuration"
|
||||||
echo " $ ks-upa -e - Edit configuration"
|
echo " $ ks-upa -e - Edit configuration"
|
||||||
|
echo " $ ks-upv -p - Generate certificate"
|
||||||
echo " $ ks-upa -v - Show version"
|
echo " $ ks-upa -v - Show version"
|
||||||
echo " $ ks-upa -h - Show help"
|
echo " $ ks-upa -h - Show help"
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -760,15 +787,18 @@ if [ "${1}" == "-r" ] ; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# Show configuration file
|
# Show configuration file
|
||||||
if [ "${1}" == "-c" ] ; then
|
if [ "${1}" == "-c" ] ; then
|
||||||
showConfig
|
showConfig
|
||||||
# Show configuration file
|
# Edit configuration file
|
||||||
elif [ "${1}" == "-e" ] ; then
|
elif [ "${1}" == "-e" ] ; then
|
||||||
editConfig
|
editConfig
|
||||||
# Show the version
|
# Show the version
|
||||||
elif [ "${1}" == "-v" ] ; then
|
elif [ "${1}" == "-v" ] ; then
|
||||||
showVersion
|
showVersion
|
||||||
|
# Generate certificate
|
||||||
|
elif [ "${1}" == "-p" ] ; then
|
||||||
|
gen_pem_ssh
|
||||||
# Show the help
|
# Show the help
|
||||||
elif [ "${1}" == "-h" ] ; then
|
elif [ "${1}" == "-h" ] ; then
|
||||||
showHelp
|
showHelp
|
||||||
|
|
38
src/ks-upf
38
src/ks-upf
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# ks-upf (ks-tools) - Upload common file(s) to server with scp or rsync #
|
# ks-upf (ks-tools) - Upload common file(s) to server with scp or rsync #
|
||||||
# Date: 13-02-2023 #
|
# Date: 11-03-2023 #
|
||||||
# Author: q3aql #
|
# Author: q3aql #
|
||||||
# Contact: q3aql@duck.com #
|
# Contact: q3aql@duck.com #
|
||||||
#########################################################################
|
#########################################################################
|
||||||
VERSION="8.4-dev"
|
VERSION="8.4-dev"
|
||||||
M_DATE="130223"
|
M_DATE="110323"
|
||||||
|
|
||||||
# Global parameters.
|
# Global parameters.
|
||||||
dirTemp="/tmp"
|
dirTemp="/tmp"
|
||||||
|
@ -424,6 +424,32 @@ function decrypt_kstools() {
|
||||||
echo ${pass_decrypt}
|
echo ${pass_decrypt}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to generate certificate on remote machine
|
||||||
|
function gen_pem_ssh() {
|
||||||
|
userhost="${USER}"
|
||||||
|
name_host="${HOSTNAME}"
|
||||||
|
echo "" && echo "* Generating .pem file to connect to this machine (${userhost})."
|
||||||
|
ssh-keygen << EOF
|
||||||
|
${userhost}
|
||||||
|
EOF
|
||||||
|
mv ${userhost} ${userhost}-${name_host}.pem
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
chmod 700 ~/.ssh
|
||||||
|
touch ~/.ssh/authorized_keys
|
||||||
|
chmod 600 ~/.ssh/authorized_keys
|
||||||
|
echo "* Adding entry in the file ~/.ssh/authorized_keys"
|
||||||
|
cat ${userhost}.pub >> ~/.ssh/authorized_keys
|
||||||
|
rm -rf ${userhost}.pub
|
||||||
|
echo ""
|
||||||
|
echo "+ Copy the ${userhost}-${name_host}.pem file to your computer to connect to this machine."
|
||||||
|
if [ -f /usr/bin/puttygen ] ; then
|
||||||
|
puttygen ${userhost}-${name_host}.pem -o ${userhost}-${name_host}.ppk -O private
|
||||||
|
echo "+ Copy the ${userhost}-${name_host}.ppk file to your computer to connect to this machine."
|
||||||
|
fi
|
||||||
|
echo "+ Connect: ssh -i ${userhost}-${name_host}.pem ${userhost}@${name_host}"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
# Function to show config
|
# Function to show config
|
||||||
function showConfig() {
|
function showConfig() {
|
||||||
configAvailable=0
|
configAvailable=0
|
||||||
|
@ -676,6 +702,7 @@ function showHelp() {
|
||||||
echo " $ ks-upf -r - Remove configuration"
|
echo " $ ks-upf -r - Remove configuration"
|
||||||
echo " $ ks-upf -c - Show configuration"
|
echo " $ ks-upf -c - Show configuration"
|
||||||
echo " $ ks-upf -e - Edit configuration"
|
echo " $ ks-upf -e - Edit configuration"
|
||||||
|
echo " $ ks-upv -p - Generate certificate"
|
||||||
echo " $ ks-upf -v - Show version"
|
echo " $ ks-upf -v - Show version"
|
||||||
echo " $ ks-upf -h - Show help"
|
echo " $ ks-upf -h - Show help"
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -787,15 +814,18 @@ if [ "${1}" == "-r" ] ; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# Show configuration file
|
# Show configuration file
|
||||||
if [ "${1}" == "-c" ] ; then
|
if [ "${1}" == "-c" ] ; then
|
||||||
showConfig
|
showConfig
|
||||||
# Show configuration file
|
# Edit configuration file
|
||||||
elif [ "${1}" == "-e" ] ; then
|
elif [ "${1}" == "-e" ] ; then
|
||||||
editConfig
|
editConfig
|
||||||
# Show the version
|
# Show the version
|
||||||
elif [ "${1}" == "-v" ] ; then
|
elif [ "${1}" == "-v" ] ; then
|
||||||
showVersion
|
showVersion
|
||||||
|
# Generate certificate
|
||||||
|
elif [ "${1}" == "-p" ] ; then
|
||||||
|
gen_pem_ssh
|
||||||
# Show the help
|
# Show the help
|
||||||
elif [ "${1}" == "-h" ] ; then
|
elif [ "${1}" == "-h" ] ; then
|
||||||
showHelp
|
showHelp
|
||||||
|
|
38
src/ks-upr
38
src/ks-upr
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# ks-upr (ks-tools) - Upload recursively file(s) to server with scp or rsync #
|
# ks-upr (ks-tools) - Upload recursively file(s) to server with scp or rsync #
|
||||||
# Date: 13-02-2023 #
|
# Date: 11-03-2023 #
|
||||||
# Author: q3aql #
|
# Author: q3aql #
|
||||||
# Contact: q3aql@duck.com #
|
# Contact: q3aql@duck.com #
|
||||||
##############################################################################
|
##############################################################################
|
||||||
VERSION="8.4-dev"
|
VERSION="8.4-dev"
|
||||||
M_DATE="130223"
|
M_DATE="110323"
|
||||||
|
|
||||||
# Global parameters.
|
# Global parameters.
|
||||||
dirTemp="/tmp"
|
dirTemp="/tmp"
|
||||||
|
@ -301,6 +301,32 @@ function decrypt_kstools() {
|
||||||
echo ${pass_decrypt}
|
echo ${pass_decrypt}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to generate certificate on remote machine
|
||||||
|
function gen_pem_ssh() {
|
||||||
|
userhost="${USER}"
|
||||||
|
name_host="${HOSTNAME}"
|
||||||
|
echo "" && echo "* Generating .pem file to connect to this machine (${userhost})."
|
||||||
|
ssh-keygen << EOF
|
||||||
|
${userhost}
|
||||||
|
EOF
|
||||||
|
mv ${userhost} ${userhost}-${name_host}.pem
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
chmod 700 ~/.ssh
|
||||||
|
touch ~/.ssh/authorized_keys
|
||||||
|
chmod 600 ~/.ssh/authorized_keys
|
||||||
|
echo "* Adding entry in the file ~/.ssh/authorized_keys"
|
||||||
|
cat ${userhost}.pub >> ~/.ssh/authorized_keys
|
||||||
|
rm -rf ${userhost}.pub
|
||||||
|
echo ""
|
||||||
|
echo "+ Copy the ${userhost}-${name_host}.pem file to your computer to connect to this machine."
|
||||||
|
if [ -f /usr/bin/puttygen ] ; then
|
||||||
|
puttygen ${userhost}-${name_host}.pem -o ${userhost}-${name_host}.ppk -O private
|
||||||
|
echo "+ Copy the ${userhost}-${name_host}.ppk file to your computer to connect to this machine."
|
||||||
|
fi
|
||||||
|
echo "+ Connect: ssh -i ${userhost}-${name_host}.pem ${userhost}@${name_host}"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
# Function to show config
|
# Function to show config
|
||||||
function showConfig() {
|
function showConfig() {
|
||||||
configAvailable=0
|
configAvailable=0
|
||||||
|
@ -553,6 +579,7 @@ function showHelp() {
|
||||||
echo " $ ks-upr -r - Remove configuration"
|
echo " $ ks-upr -r - Remove configuration"
|
||||||
echo " $ ks-upr -c - Show configuration"
|
echo " $ ks-upr -c - Show configuration"
|
||||||
echo " $ ks-upr -e - Edit configuration"
|
echo " $ ks-upr -e - Edit configuration"
|
||||||
|
echo " $ ks-upv -p - Generate certificate"
|
||||||
echo " $ ks-upr -v - Show version"
|
echo " $ ks-upr -v - Show version"
|
||||||
echo " $ ks-upr -h - Show help"
|
echo " $ ks-upr -h - Show help"
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -664,15 +691,18 @@ if [ "${1}" == "-r" ] ; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# Show configuration file
|
# Show configuration file
|
||||||
if [ "${1}" == "-c" ] ; then
|
if [ "${1}" == "-c" ] ; then
|
||||||
showConfig
|
showConfig
|
||||||
# Show configuration file
|
# Edit configuration file
|
||||||
elif [ "${1}" == "-e" ] ; then
|
elif [ "${1}" == "-e" ] ; then
|
||||||
editConfig
|
editConfig
|
||||||
# Show the version
|
# Show the version
|
||||||
elif [ "${1}" == "-v" ] ; then
|
elif [ "${1}" == "-v" ] ; then
|
||||||
showVersion
|
showVersion
|
||||||
|
# Generate certificate
|
||||||
|
elif [ "${1}" == "-p" ] ; then
|
||||||
|
gen_pem_ssh
|
||||||
# Show the help
|
# Show the help
|
||||||
elif [ "${1}" == "-h" ] ; then
|
elif [ "${1}" == "-h" ] ; then
|
||||||
showHelp
|
showHelp
|
||||||
|
|
36
src/ks-upv
36
src/ks-upv
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# ks-upv (ks-tools) - Upload videos file(s) to server with scp or rsync #
|
# ks-upv (ks-tools) - Upload videos file(s) to server with scp or rsync #
|
||||||
# Date: 13-02-2023 #
|
# Date: 11-03-2023 #
|
||||||
# Author: q3aql #
|
# Author: q3aql #
|
||||||
# Contact: q3aql@duck.com #
|
# Contact: q3aql@duck.com #
|
||||||
#########################################################################
|
#########################################################################
|
||||||
VERSION="8.4-dev"
|
VERSION="8.4-dev"
|
||||||
M_DATE="130223"
|
M_DATE="110323"
|
||||||
|
|
||||||
# Global parameters.
|
# Global parameters.
|
||||||
dirTemp="/tmp"
|
dirTemp="/tmp"
|
||||||
|
@ -397,6 +397,32 @@ function decrypt_kstools() {
|
||||||
echo ${pass_decrypt}
|
echo ${pass_decrypt}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to generate certificate on remote machine
|
||||||
|
function gen_pem_ssh() {
|
||||||
|
userhost="${USER}"
|
||||||
|
name_host="${HOSTNAME}"
|
||||||
|
echo "" && echo "* Generating .pem file to connect to this machine (${userhost})."
|
||||||
|
ssh-keygen << EOF
|
||||||
|
${userhost}
|
||||||
|
EOF
|
||||||
|
mv ${userhost} ${userhost}-${name_host}.pem
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
chmod 700 ~/.ssh
|
||||||
|
touch ~/.ssh/authorized_keys
|
||||||
|
chmod 600 ~/.ssh/authorized_keys
|
||||||
|
echo "* Adding entry in the file ~/.ssh/authorized_keys"
|
||||||
|
cat ${userhost}.pub >> ~/.ssh/authorized_keys
|
||||||
|
rm -rf ${userhost}.pub
|
||||||
|
echo ""
|
||||||
|
echo "+ Copy the ${userhost}-${name_host}.pem file to your computer to connect to this machine."
|
||||||
|
if [ -f /usr/bin/puttygen ] ; then
|
||||||
|
puttygen ${userhost}-${name_host}.pem -o ${userhost}-${name_host}.ppk -O private
|
||||||
|
echo "+ Copy the ${userhost}-${name_host}.ppk file to your computer to connect to this machine."
|
||||||
|
fi
|
||||||
|
echo "+ Connect: ssh -i ${userhost}-${name_host}.pem ${userhost}@${name_host}"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
# Function to show config
|
# Function to show config
|
||||||
function showConfig() {
|
function showConfig() {
|
||||||
configAvailable=0
|
configAvailable=0
|
||||||
|
@ -649,6 +675,7 @@ function showHelp() {
|
||||||
echo " $ ks-upv -r - Remove configuration"
|
echo " $ ks-upv -r - Remove configuration"
|
||||||
echo " $ ks-upv -c - Show configuration"
|
echo " $ ks-upv -c - Show configuration"
|
||||||
echo " $ ks-upv -e - Edit configuration"
|
echo " $ ks-upv -e - Edit configuration"
|
||||||
|
echo " $ ks-upv -p - Generate certificate"
|
||||||
echo " $ ks-upv -v - Show version"
|
echo " $ ks-upv -v - Show version"
|
||||||
echo " $ ks-upv -h - Show help"
|
echo " $ ks-upv -h - Show help"
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -763,12 +790,15 @@ fi
|
||||||
# Show configuration file
|
# Show configuration file
|
||||||
if [ "${1}" == "-c" ] ; then
|
if [ "${1}" == "-c" ] ; then
|
||||||
showConfig
|
showConfig
|
||||||
# Show configuration file
|
# Edit configuration file
|
||||||
elif [ "${1}" == "-e" ] ; then
|
elif [ "${1}" == "-e" ] ; then
|
||||||
editConfig
|
editConfig
|
||||||
# Show the version
|
# Show the version
|
||||||
elif [ "${1}" == "-v" ] ; then
|
elif [ "${1}" == "-v" ] ; then
|
||||||
showVersion
|
showVersion
|
||||||
|
# Generate certificate
|
||||||
|
elif [ "${1}" == "-p" ] ; then
|
||||||
|
gen_pem_ssh
|
||||||
# Show the help
|
# Show the help
|
||||||
elif [ "${1}" == "-h" ] ; then
|
elif [ "${1}" == "-h" ] ; then
|
||||||
showHelp
|
showHelp
|
||||||
|
|
Loading…
Reference in New Issue
Block a user