Standardise password lengths
This commit is contained in:
parent
f460e0c033
commit
152360ab96
|
@ -6188,7 +6188,7 @@ function install_mariadb {
|
|||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
MARIADB_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
MARIADB_PASSWORD="$(openssl rand -base64 32 | cut -c1-30)"
|
||||
MARIADB_PASSWORD="$(openssl rand -base64 32 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
echo "$MARIADB_PASSWORD" > $DATABASE_PASSWORD_FILE
|
||||
chmod 600 $DATABASE_PASSWORD_FILE
|
||||
|
@ -6547,7 +6547,7 @@ function install_gogs {
|
|||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
GIT_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
GIT_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-30)"
|
||||
GIT_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -6742,7 +6742,7 @@ function install_gogs {
|
|||
if grep -q "Gogs secret key:" /home/$MY_USERNAME/README; then
|
||||
GOGS_SECRET_KEY=$(cat /home/$MY_USERNAME/README | grep "Gogs secret key:" | awk -F ':' '{print $2}' | sed 's/^ *//')
|
||||
else
|
||||
GOGS_SECRET_KEY="$(openssl rand -base64 20 | cut -c1-18)"
|
||||
GOGS_SECRET_KEY="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
echo "Gogs secret key:$GOGS_SECRET_KEY" >> /home/$MY_USERNAME/README
|
||||
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
|
||||
fi
|
||||
|
@ -7134,7 +7134,7 @@ function install_xmpp {
|
|||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
XMPP_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
XMPP_PASSWORD="$(openssl rand -base64 10 | cut -c1-8)"
|
||||
XMPP_PASSWORD="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
fi
|
||||
prosodyctl register $MY_USERNAME $DEFAULT_DOMAIN_NAME $XMPP_PASSWORD
|
||||
|
@ -7347,7 +7347,7 @@ function install_irc_server {
|
|||
|
||||
# create a login password if needed
|
||||
if [ ! $IRC_PASSWORD ]; then
|
||||
IRC_PASSWORD="$(openssl rand -base64 32 | cut -c1-10)"
|
||||
IRC_PASSWORD="$(openssl rand -base64 32 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
|
||||
echo '**************************************************' > /etc/ngircd/motd
|
||||
|
@ -7374,7 +7374,7 @@ function install_irc_server {
|
|||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
IRC_OPERATOR_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
IRC_OPERATOR_PASSWORD="$(openssl rand -base64 10 | cut -c1-8)"
|
||||
IRC_OPERATOR_PASSWORD="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
sed -i "s|;CloakHostSalt = abcdefghijklmnopqrstuvwxyz|CloakHostSalt = $IRC_SALT|g" /etc/ngircd/ngircd.conf
|
||||
sed -i 's/;ConnectIPv4 = yes/ConnectIPv4 = yes/g' /etc/ngircd/ngircd.conf
|
||||
|
@ -7512,7 +7512,7 @@ function install_wiki {
|
|||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
WIKI_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
WIKI_ADMIN_PASSWORD="$(openssl rand -base64 18 | cut -c1-16)"
|
||||
WIKI_ADMIN_PASSWORD="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
fi
|
||||
HASHED_WIKI_PASSWORD=$(echo -n "$WIKI_ADMIN_PASSWORD" | md5sum | awk -F ' ' '{print $1}')
|
||||
|
@ -8117,7 +8117,7 @@ function install_blog {
|
|||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
FULLBLOG_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
FULLBLOG_ADMIN_PASSWORD="$(openssl rand -base64 18 | cut -c1-16)"
|
||||
FULLBLOG_ADMIN_PASSWORD="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
echo '' >> /home/$MY_USERNAME/README
|
||||
echo '' >> /home/$MY_USERNAME/README
|
||||
|
@ -8203,7 +8203,7 @@ function install_rss_reader {
|
|||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
RSS_READER_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
RSS_READER_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-30)"
|
||||
RSS_READER_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -8573,7 +8573,7 @@ function install_gnu_social {
|
|||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
MICROBLOG_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
MICROBLOG_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-30)"
|
||||
MICROBLOG_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -9278,7 +9278,7 @@ function install_search_engine {
|
|||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
SEARCH_ENGINE_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
SEARCH_ENGINE_PASSWORD="$(openssl rand -base64 18 | cut -c1-16)"
|
||||
SEARCH_ENGINE_PASSWORD="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
fi
|
||||
echo "$SEARCH_ENGINE_PASSWORD" | htpasswd -i -s -c /etc/nginx/.htpasswd $MY_USERNAME
|
||||
|
@ -9347,7 +9347,7 @@ function install_webmail {
|
|||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
WEBMAIL_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
WEBMAIL_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-30)"
|
||||
WEBMAIL_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
fi
|
||||
create_database webmail "$WEBMAIL_ADMIN_PASSWORD"
|
||||
|
@ -9513,7 +9513,7 @@ function install_hubzilla {
|
|||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
HUBZILLA_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
HUBZILLA_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-30)"
|
||||
HUBZILLA_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
echo '' >> /home/$MY_USERNAME/README
|
||||
echo '' >> /home/$MY_USERNAME/README
|
||||
|
@ -10645,9 +10645,9 @@ function install_voip {
|
|||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
VOIP_SERVER_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
VOIP_SERVER_PASSWORD="$(openssl rand -base64 18 | cut -c1-16)"
|
||||
VOIP_SERVER_PASSWORD="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
if [ ${#VOIP_SERVER_PASSWORD} -lt $MINIMUM_PASSWORD_LENGTH ]; then
|
||||
VOIP_SERVER_PASSWORD="$(openssl rand -base64 18 | cut -c1-16)"
|
||||
VOIP_SERVER_PASSWORD="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -10778,7 +10778,7 @@ function install_sip {
|
|||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
SIP_SERVER_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
SIP_SERVER_PASSWORD="$(openssl rand -base64 12 | cut -c1-10)"
|
||||
SIP_SERVER_PASSWORD="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -61,7 +61,17 @@ if [ ! -f $COMPLETION_FILE ]; then
|
|||
exit 3
|
||||
fi
|
||||
|
||||
NEW_USER_PASSWORD="$(openssl rand -base64 10 | cut -c1-8)"
|
||||
# Minimum number of characters in a password
|
||||
MINIMUM_PASSWORD_LENGTH=10
|
||||
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
|
||||
MINIMUM_PASSWORD_LENGTH=$(cat /usr/local/bin/${PROJECT_NAME} | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
||||
else
|
||||
if [ -f /usr/bin/${PROJECT_NAME} ]; then
|
||||
MINIMUM_PASSWORD_LENGTH=$(cat /usr/bin/${PROJECT_NAME} | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
||||
fi
|
||||
fi
|
||||
|
||||
NEW_USER_PASSWORD="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
useradd -m -p "$NEW_USER_PASSWORD" -s /bin/bash $MY_USERNAME
|
||||
adduser $MY_USERNAME sasl
|
||||
|
||||
|
|
|
@ -44,6 +44,13 @@ FREEDOMBONE_WEBSITE="http://freedombone.uk.to"
|
|||
|
||||
# Minimum number of characters in a password
|
||||
MINIMUM_PASSWORD_LENGTH=10
|
||||
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
|
||||
MINIMUM_PASSWORD_LENGTH=$(cat /usr/local/bin/${PROJECT_NAME} | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
||||
else
|
||||
if [ -f /usr/bin/${PROJECT_NAME} ]; then
|
||||
MINIMUM_PASSWORD_LENGTH=$(cat /usr/bin/${PROJECT_NAME} | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
||||
fi
|
||||
fi
|
||||
|
||||
# file containing new password
|
||||
IMAGE_PASSWORD_FILE=/root/login.txt
|
||||
|
|
|
@ -41,7 +41,14 @@ UPGRADE_SCRIPT_NAME="${PROJECT_NAME}-upgrade"
|
|||
UPDATE_DATE_SCRIPT=/usr/bin/updatedate
|
||||
|
||||
# Minimum number of characters in a password
|
||||
MINIMUM_PASSWORD_LENGTH=8
|
||||
MINIMUM_PASSWORD_LENGTH=10
|
||||
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
|
||||
MINIMUM_PASSWORD_LENGTH=$(cat /usr/local/bin/${PROJECT_NAME} | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
||||
else
|
||||
if [ -f /usr/bin/${PROJECT_NAME} ]; then
|
||||
MINIMUM_PASSWORD_LENGTH=$(cat /usr/bin/${PROJECT_NAME} | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
||||
fi
|
||||
fi
|
||||
|
||||
# voip
|
||||
VOIP_PORT=64738
|
||||
|
|
|
@ -77,6 +77,13 @@ DEFAULT_DOMAIN_NAME="${PROJECT_NAME}.local"
|
|||
|
||||
# Minimum number of characters in a password
|
||||
MINIMUM_PASSWORD_LENGTH=10
|
||||
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
|
||||
MINIMUM_PASSWORD_LENGTH=$(cat /usr/local/bin/${PROJECT_NAME} | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
||||
else
|
||||
if [ -f /usr/bin/${PROJECT_NAME} ]; then
|
||||
MINIMUM_PASSWORD_LENGTH=$(cat /usr/bin/${PROJECT_NAME} | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
||||
fi
|
||||
fi
|
||||
|
||||
# Optional ssh public key to allow
|
||||
SSH_PUBKEY="no"
|
||||
|
@ -287,7 +294,7 @@ fi
|
|||
|
||||
if [ ! $PASSWORD ]; then
|
||||
# generate a random password
|
||||
PASSWORD="$(openssl rand -base64 10 | cut -c1-8)"
|
||||
PASSWORD="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
|
||||
# Move any existing images into a build subdirectory
|
||||
|
|
|
@ -49,6 +49,16 @@ MINIMAL_INSTALL="yes"
|
|||
MY_USERNAME='debian'
|
||||
MY_PASSWORD="${PROJECT_NAME}"
|
||||
|
||||
# Minimum number of characters in a password
|
||||
MINIMUM_PASSWORD_LENGTH=10
|
||||
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
|
||||
MINIMUM_PASSWORD_LENGTH=$(cat /usr/local/bin/${PROJECT_NAME} | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
||||
else
|
||||
if [ -f /usr/bin/${PROJECT_NAME} ]; then
|
||||
MINIMUM_PASSWORD_LENGTH=$(cat /usr/bin/${PROJECT_NAME} | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
||||
fi
|
||||
fi
|
||||
|
||||
# IP address of the router (gateway)
|
||||
ROUTER_IP_ADDRESS="192.168.1.254"
|
||||
|
||||
|
@ -283,7 +293,8 @@ EOF
|
|||
echo " dialog --backtitle \"${ENTROPY_MESSAGE1}\" --title \"${ENTROPY_MESSAGE2}\" --msgbox \"${ENTROPY_MESSAGE3}\" 8 50" >> $rootdir/root/.bashrc
|
||||
echo ' exit' >> $rootdir/root/.bashrc
|
||||
echo ' fi' >> $rootdir/root/.bashrc
|
||||
echo ' NEW_USER_PASSWORD="$(openssl rand -base64 12 | cut -c1-10)"' >> $rootdir/root/.bashrc
|
||||
echo -n ' NEW_USER_PASSWORD="$(openssl rand -base64 30 | cut -c1-' >> $rootdir/root/.bashrc
|
||||
echo "${MINIMUM_PASSWORD_LENGTH})\"" >> $rootdir/root/.bashrc
|
||||
echo ' fi' >> $rootdir/root/.bashrc
|
||||
echo ' echo "${NEW_USER_PASSWORD}" > ~/login.txt' >> $rootdir/root/.bashrc
|
||||
|
||||
|
|
|
@ -35,6 +35,13 @@ export TEXTDOMAINDIR="/usr/share/locale"
|
|||
|
||||
# Minimum number of characters in a password
|
||||
MINIMUM_PASSWORD_LENGTH=10
|
||||
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
|
||||
MINIMUM_PASSWORD_LENGTH=$(cat /usr/local/bin/${PROJECT_NAME} | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
||||
else
|
||||
if [ -f /usr/bin/${PROJECT_NAME} ]; then
|
||||
MINIMUM_PASSWORD_LENGTH=$(cat /usr/bin/${PROJECT_NAME} | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
||||
fi
|
||||
fi
|
||||
|
||||
CONFIGURATION_FILE="/root/${PROJECT_NAME}.cfg"
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ PROJECT_NAME='freedombone'
|
|||
export TEXTDOMAIN=${PROJECT_NAME}-remote
|
||||
export TEXTDOMAINDIR="/usr/share/locale"
|
||||
|
||||
CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg
|
||||
|
||||
# User to create the list for
|
||||
MY_USERNAME=$USER
|
||||
|
||||
|
@ -42,7 +44,14 @@ MY_USERNAME=$USER
|
|||
FRIENDS_SERVERS_LIST=
|
||||
|
||||
# Minimum password length in characters
|
||||
MINIMUM_PASSWORD_LENGTH=8
|
||||
MINIMUM_PASSWORD_LENGTH=10
|
||||
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
|
||||
MINIMUM_PASSWORD_LENGTH=$(cat /usr/local/bin/${PROJECT_NAME} | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
||||
else
|
||||
if [ -f /usr/bin/${PROJECT_NAME} ]; then
|
||||
MINIMUM_PASSWORD_LENGTH=$(cat /usr/bin/${PROJECT_NAME} | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
||||
fi
|
||||
fi
|
||||
|
||||
# How many remote locations were specified
|
||||
entering_remote_backups_ctr=0
|
||||
|
@ -78,61 +87,61 @@ do
|
|||
key="$1"
|
||||
|
||||
case $key in
|
||||
-h|--help)
|
||||
show_help
|
||||
;;
|
||||
# backup list filename
|
||||
# typically /home/$USER/backup.list
|
||||
-l|--list)
|
||||
shift
|
||||
FRIENDS_SERVERS_LIST="$1"
|
||||
;;
|
||||
# username within /home
|
||||
-u|--user)
|
||||
shift
|
||||
MY_USERNAME="$1"
|
||||
;;
|
||||
# Minimum password length
|
||||
-m|--min)
|
||||
shift
|
||||
MINIMUM_PASSWORD_LENGTH="$1"
|
||||
;;
|
||||
# Title shown
|
||||
-t|--title)
|
||||
shift
|
||||
TITLE="$1"
|
||||
;;
|
||||
# reciprocal user accounts
|
||||
-r|--reciprocal)
|
||||
shift
|
||||
RECIPROCAL="yes"
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
-h|--help)
|
||||
show_help
|
||||
;;
|
||||
# backup list filename
|
||||
# typically /home/$USER/backup.list
|
||||
-l|--list)
|
||||
shift
|
||||
FRIENDS_SERVERS_LIST="$1"
|
||||
;;
|
||||
# username within /home
|
||||
-u|--user)
|
||||
shift
|
||||
MY_USERNAME="$1"
|
||||
;;
|
||||
# Minimum password length
|
||||
-m|--min)
|
||||
shift
|
||||
MINIMUM_PASSWORD_LENGTH="$1"
|
||||
;;
|
||||
# Title shown
|
||||
-t|--title)
|
||||
shift
|
||||
TITLE="$1"
|
||||
;;
|
||||
# reciprocal user accounts
|
||||
-r|--reciprocal)
|
||||
shift
|
||||
RECIPROCAL="yes"
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
function interactive_configuration_remote_backups {
|
||||
if [ ! $MY_USERNAME ]; then
|
||||
echo $'Please specify a username with the -u option'
|
||||
exit 7356
|
||||
echo $'Please specify a username with the -u option'
|
||||
exit 7356
|
||||
fi
|
||||
|
||||
if [ ! /home/$MY_USERNAME ]; then
|
||||
echo $"The user /home/$MY_USERNAME does not exist on the system"
|
||||
exit 3689
|
||||
echo $"The user /home/$MY_USERNAME does not exist on the system"
|
||||
exit 3689
|
||||
fi
|
||||
|
||||
if [ ! $FRIENDS_SERVERS_LIST ]; then
|
||||
FRIENDS_SERVERS_LIST=/home/$MY_USERNAME/backup.list
|
||||
FRIENDS_SERVERS_LIST=/home/$MY_USERNAME/backup.list
|
||||
fi
|
||||
|
||||
# clear any existing list
|
||||
if [ -f $FRIENDS_SERVERS_LIST ]; then
|
||||
rm -f $FRIENDS_SERVERS_LIST
|
||||
touch $FRIENDS_SERVERS_LIST
|
||||
rm -f $FRIENDS_SERVERS_LIST
|
||||
touch $FRIENDS_SERVERS_LIST
|
||||
fi
|
||||
# number of entries made
|
||||
entering_remote_backups_ctr=1
|
||||
|
@ -146,103 +155,103 @@ function interactive_configuration_remote_backups {
|
|||
remote_ssh_reciprocal_password=""
|
||||
while [[ $entering_remote_backups_done == "no" ]]
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
if [[ $RECIPROCAL == "yes" ]]; then
|
||||
dialog --backtitle "Freedombone Configuration" \
|
||||
--title "$TITLE ${entering_remote_backups_ctr}" \
|
||||
--form "\nPlease specify the SSH login details for the remote server\n\nThe reciprocal entries are optional, and can be used if you wish to set up a user account on this system for whoever runs the remote server to also use for backups" 20 50 8 \
|
||||
"Username:" 1 1 "$remote_ssh_username" 1 23 16 15 \
|
||||
"Domain:" 2 1 "$remote_ssh_domain" 2 23 16 15 \
|
||||
"SSH port:" 3 1 "2222" 3 23 5 4 \
|
||||
"Password:" 4 1 "$remote_ssh_password" 4 23 20 100 \
|
||||
"Reciprocal Username:" 5 1 "$remote_ssh_reciprocal_username" 5 23 20 100 \
|
||||
"Reciprocal Password:" 6 1 "$remote_ssh_reciprocal_password" 6 23 20 100 \
|
||||
2> $data
|
||||
else
|
||||
dialog --backtitle "Freedombone Configuration" \
|
||||
--title "$TITLE ${entering_remote_backups_ctr}" \
|
||||
--form "\nPlease specify the SSH login details for the remote server" 15 50 4 \
|
||||
"Username:" 1 1 "$remote_ssh_username" 1 23 16 15 \
|
||||
"Domain:" 2 1 "$remote_ssh_domain" 2 23 16 15 \
|
||||
"SSH port:" 3 1 "2222" 3 23 5 4 \
|
||||
"Password:" 4 1 "$remote_ssh_password" 4 23 20 100 \
|
||||
2> $data
|
||||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) entering_remote_backups_done="yes";;
|
||||
255) entering_remote_backups_done="yes";;
|
||||
esac
|
||||
remote_ssh_username=$(cat $data | sed -n 1p)
|
||||
remote_ssh_domain=$(cat $data | sed -n 2p)
|
||||
remote_ssh_port=$(cat $data | sed -n 3p)
|
||||
remote_ssh_password=$(cat $data | sed -n 4p)
|
||||
remote_ssh_reciprocal_username=$(cat $data | sed -n 5p)
|
||||
remote_ssh_reciprocal_password=$(cat $data | sed -n 6p)
|
||||
if [[ $remote_ssh_username != "" && \
|
||||
$remote_ssh_domain != "" && \
|
||||
$remote_ssh_port != "" && \
|
||||
$remote_ssh_password != "" ]]; then
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
if [[ $RECIPROCAL == "yes" ]]; then
|
||||
dialog --backtitle "Freedombone Configuration" \
|
||||
--title "$TITLE ${entering_remote_backups_ctr}" \
|
||||
--form "\nPlease specify the SSH login details for the remote server\n\nThe reciprocal entries are optional, and can be used if you wish to set up a user account on this system for whoever runs the remote server to also use for backups" 20 50 8 \
|
||||
"Username:" 1 1 "$remote_ssh_username" 1 23 16 15 \
|
||||
"Domain:" 2 1 "$remote_ssh_domain" 2 23 16 15 \
|
||||
"SSH port:" 3 1 "2222" 3 23 5 4 \
|
||||
"Password:" 4 1 "$remote_ssh_password" 4 23 20 100 \
|
||||
"Reciprocal Username:" 5 1 "$remote_ssh_reciprocal_username" 5 23 20 100 \
|
||||
"Reciprocal Password:" 6 1 "$remote_ssh_reciprocal_password" 6 23 20 100 \
|
||||
2> $data
|
||||
else
|
||||
dialog --backtitle "Freedombone Configuration" \
|
||||
--title "$TITLE ${entering_remote_backups_ctr}" \
|
||||
--form "\nPlease specify the SSH login details for the remote server" 15 50 4 \
|
||||
"Username:" 1 1 "$remote_ssh_username" 1 23 16 15 \
|
||||
"Domain:" 2 1 "$remote_ssh_domain" 2 23 16 15 \
|
||||
"SSH port:" 3 1 "2222" 3 23 5 4 \
|
||||
"Password:" 4 1 "$remote_ssh_password" 4 23 20 100 \
|
||||
2> $data
|
||||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) entering_remote_backups_done="yes";;
|
||||
255) entering_remote_backups_done="yes";;
|
||||
esac
|
||||
remote_ssh_username=$(cat $data | sed -n 1p)
|
||||
remote_ssh_domain=$(cat $data | sed -n 2p)
|
||||
remote_ssh_port=$(cat $data | sed -n 3p)
|
||||
remote_ssh_password=$(cat $data | sed -n 4p)
|
||||
remote_ssh_reciprocal_username=$(cat $data | sed -n 5p)
|
||||
remote_ssh_reciprocal_password=$(cat $data | sed -n 6p)
|
||||
if [[ $remote_ssh_username != "" && \
|
||||
$remote_ssh_domain != "" && \
|
||||
$remote_ssh_port != "" && \
|
||||
$remote_ssh_password != "" ]]; then
|
||||
|
||||
if [ ${#remote_ssh_password} -lt $MINIMUM_PASSWORD_LENGTH ]; then
|
||||
dialog --title "Password quality check" --msgbox "The password given was too short. It must be at least $MINIMUM_PASSWORD_LENGTH characters" 6 40
|
||||
else
|
||||
if [ ${#remote_ssh_password} -lt $MINIMUM_PASSWORD_LENGTH ]; then
|
||||
dialog --title "Password quality check" --msgbox "The password given was too short. It must be at least $MINIMUM_PASSWORD_LENGTH characters" 6 40
|
||||
else
|
||||
|
||||
if [[ $RECIPROCAL == "yes" ]]; then
|
||||
if [[ $remote_ssh_reciprocal_username != "" && \
|
||||
$remote_ssh_reciprocal_password != "" ]]; then
|
||||
if [ ${#remote_ssh_reciprocal_password} -lt $MINIMUM_PASSWORD_LENGTH ]; then
|
||||
dialog --title "Password quality check" --msgbox "The reciprocal password given was too short. It must be at least $MINIMUM_PASSWORD_LENGTH characters" 6 40
|
||||
else
|
||||
echo ${remote_ssh_reciprocal_username}:${remote_ssh_reciprocal_password}::::/home/${remote_ssh_reciprocal_username}:bash | newusers
|
||||
echo "$remote_ssh_username@$remote_ssh_domain $remote_ssh_port /home/$remote_ssh_username $remote_ssh_password" >> $FRIENDS_SERVERS_LIST
|
||||
remote_ssh_username=""
|
||||
remote_ssh_domain=""
|
||||
remote_ssh_port=""
|
||||
remote_ssh_password=""
|
||||
remote_ssh_reciprocal_username=""
|
||||
remote_ssh_reciprocal_password=""
|
||||
entering_remote_backups_ctr=$((entering_remote_backups_ctr + 1))
|
||||
fi
|
||||
else
|
||||
echo "$remote_ssh_username@$remote_ssh_domain $remote_ssh_port /home/$remote_ssh_username $remote_ssh_password" >> $FRIENDS_SERVERS_LIST
|
||||
remote_ssh_username=""
|
||||
remote_ssh_domain=""
|
||||
remote_ssh_port=""
|
||||
remote_ssh_password=""
|
||||
remote_ssh_reciprocal_username=""
|
||||
remote_ssh_reciprocal_password=""
|
||||
entering_remote_backups_ctr=$((entering_remote_backups_ctr + 1))
|
||||
fi
|
||||
else
|
||||
echo "$remote_ssh_username@$remote_ssh_domain $remote_ssh_port /home/$remote_ssh_username $remote_ssh_password" >> $FRIENDS_SERVERS_LIST
|
||||
remote_ssh_username=""
|
||||
remote_ssh_domain=""
|
||||
remote_ssh_port=""
|
||||
remote_ssh_password=""
|
||||
entering_remote_backups_ctr=$((entering_remote_backups_ctr + 1))
|
||||
fi
|
||||
if [[ $RECIPROCAL == "yes" ]]; then
|
||||
if [[ $remote_ssh_reciprocal_username != "" && \
|
||||
$remote_ssh_reciprocal_password != "" ]]; then
|
||||
if [ ${#remote_ssh_reciprocal_password} -lt $MINIMUM_PASSWORD_LENGTH ]; then
|
||||
dialog --title "Password quality check" --msgbox "The reciprocal password given was too short. It must be at least $MINIMUM_PASSWORD_LENGTH characters" 6 40
|
||||
else
|
||||
echo ${remote_ssh_reciprocal_username}:${remote_ssh_reciprocal_password}::::/home/${remote_ssh_reciprocal_username}:bash | newusers
|
||||
echo "$remote_ssh_username@$remote_ssh_domain $remote_ssh_port /home/$remote_ssh_username $remote_ssh_password" >> $FRIENDS_SERVERS_LIST
|
||||
remote_ssh_username=""
|
||||
remote_ssh_domain=""
|
||||
remote_ssh_port=""
|
||||
remote_ssh_password=""
|
||||
remote_ssh_reciprocal_username=""
|
||||
remote_ssh_reciprocal_password=""
|
||||
entering_remote_backups_ctr=$((entering_remote_backups_ctr + 1))
|
||||
fi
|
||||
else
|
||||
echo "$remote_ssh_username@$remote_ssh_domain $remote_ssh_port /home/$remote_ssh_username $remote_ssh_password" >> $FRIENDS_SERVERS_LIST
|
||||
remote_ssh_username=""
|
||||
remote_ssh_domain=""
|
||||
remote_ssh_port=""
|
||||
remote_ssh_password=""
|
||||
remote_ssh_reciprocal_username=""
|
||||
remote_ssh_reciprocal_password=""
|
||||
entering_remote_backups_ctr=$((entering_remote_backups_ctr + 1))
|
||||
fi
|
||||
else
|
||||
echo "$remote_ssh_username@$remote_ssh_domain $remote_ssh_port /home/$remote_ssh_username $remote_ssh_password" >> $FRIENDS_SERVERS_LIST
|
||||
remote_ssh_username=""
|
||||
remote_ssh_domain=""
|
||||
remote_ssh_port=""
|
||||
remote_ssh_password=""
|
||||
entering_remote_backups_ctr=$((entering_remote_backups_ctr + 1))
|
||||
fi
|
||||
|
||||
fi
|
||||
else
|
||||
entering_remote_backups_done="yes"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
entering_remote_backups_done="yes"
|
||||
fi
|
||||
done
|
||||
if [ -f $FRIENDS_SERVERS_LIST ]; then
|
||||
chown $MY_USERNAME:$MY_USERNAME $FRIENDS_SERVERS_LIST
|
||||
chown $MY_USERNAME:$MY_USERNAME $FRIENDS_SERVERS_LIST
|
||||
fi
|
||||
}
|
||||
|
||||
function show_result {
|
||||
clear
|
||||
if (( $entering_remote_backups_ctr < 2 )); then
|
||||
echo $'No remote backup locations were specified'
|
||||
exit 0
|
||||
echo $'No remote backup locations were specified'
|
||||
exit 0
|
||||
fi
|
||||
if [ ! -f $FRIENDS_SERVERS_LIST ]; then
|
||||
echo $"No remote backups list found: $FRIENDS_SERVERS_LIST"
|
||||
exit 7358
|
||||
echo $"No remote backups list found: $FRIENDS_SERVERS_LIST"
|
||||
exit 7358
|
||||
fi
|
||||
echo ''
|
||||
echo $"Remote backups list: $FRIENDS_SERVERS_LIST"
|
||||
|
@ -254,7 +263,7 @@ function show_result {
|
|||
}
|
||||
|
||||
if [ ! $FRIENDS_SERVERS_LIST ]; then
|
||||
FRIENDS_SERVERS_LIST=/home/$MY_USERNAME/backup.list
|
||||
FRIENDS_SERVERS_LIST=/home/$MY_USERNAME/backup.list
|
||||
fi
|
||||
|
||||
interactive_configuration_remote_backups
|
||||
|
|
Loading…
Reference in New Issue