Commit 73d8e30e authored by root's avatar root
Browse files

Small fixes, hardening, cleanup

parent 027233a4
...@@ -60,9 +60,8 @@ Login as root and type: ...@@ -60,9 +60,8 @@ Login as root and type:
**Running this utility on 3rd party Debian based distributions** **Running this utility on 3rd party Debian based distributions**
# Install dependencies # Install dependencies
apt install git iperf3 qrencode psmisc curl bc expect dialog network-manager sunxi-tools iptables \ apt install git iperf3 psmisc curl bc expect dialog network-manager sunxi-tools iptables \
resolvconf debconf-utils unzip build-essential html2text apt-transport-https html2text dirmngr \ debconf-utils unzip dirmngr software-properties-common
software-properties-common libpam-google-authenticator qrencode ppp
git clone https://github.com/armbian/config git clone https://github.com/armbian/config
cd config cd config
......
...@@ -181,7 +181,7 @@ function is_package_manager_running() { ...@@ -181,7 +181,7 @@ function is_package_manager_running() {
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
# 0 = true # 0 = true
dialog --colors --title " \Z1Error\Z0 " --backtitle "$BACKTITLE" --no-collapse --msgbox \ dialog --colors --title " \Z1Error\Z0 " --backtitle "$BACKTITLE" --no-collapse --msgbox \
"\n\Z1Package manager is running in the background. \n\nCan't proceed. Try again later." 9 53 "\n\Z0Package manager is running in the background. \n\nCan't install dependencies. Try again later." 9 53
return 0 return 0
else else
# 1 = false # 1 = false
......
...@@ -326,6 +326,7 @@ function jobs () ...@@ -326,6 +326,7 @@ function jobs ()
# Connect to 3G/4G network # Connect to 3G/4G network
# #
"LTE" ) "LTE" )
if ! is_package_manager_running; then
if [[ $LTE_MODEM == *online* ]]; then if [[ $LTE_MODEM == *online* ]]; then
dialog --title " LTE modem is connected " --colors --backtitle "$BACKTITLE" --yes-label "Back" --no-label "Disconnect" --yesno "\n\Z1Disconnect:\Z0 kill mobile connection\n\n" 7 42 dialog --title " LTE modem is connected " --colors --backtitle "$BACKTITLE" --yes-label "Back" --no-label "Disconnect" --yesno "\n\Z1Disconnect:\Z0 kill mobile connection\n\n" 7 42
[[ $? = 1 ]] && lte "$LTE_MODEM_ID" "off" [[ $? = 1 ]] && lte "$LTE_MODEM_ID" "off"
...@@ -333,6 +334,7 @@ function jobs () ...@@ -333,6 +334,7 @@ function jobs ()
dialog --title " LTE modem is disconnected " --colors --backtitle "$BACKTITLE" --yes-label "Back" --no-label "Connect" --yesno "\n\Z1Connect:\Z0 dial mobile connection\n\n" 7 42 dialog --title " LTE modem is disconnected " --colors --backtitle "$BACKTITLE" --yes-label "Back" --no-label "Connect" --yesno "\n\Z1Connect:\Z0 dial mobile connection\n\n" 7 42
[[ $? = 1 ]] && lte "$LTE_MODEM_ID" "on" [[ $? = 1 ]] && lte "$LTE_MODEM_ID" "on"
fi fi
fi
;; ;;
...@@ -1131,8 +1133,14 @@ function jobs () ...@@ -1131,8 +1133,14 @@ function jobs ()
# Toggle sshd options # Toggle sshd options
# #
"SSH" ) "SSH" )
if ! is_package_manager_running; then
while true; do while true; do
if ! check_if_installed libpam-google-authenticator ; then
debconf-apt-progress -- apt-get -y install libpam-google-authenticator
fi
if ! check_if_installed qrencode ; then
debconf-apt-progress -- apt-get -y install qrencode
fi
DIALOG_CANCEL=2 DIALOG_CANCEL=2
DIALOG_ESC=255 DIALOG_ESC=255
LIST_CONST=7 LIST_CONST=7
...@@ -1193,12 +1201,6 @@ function jobs () ...@@ -1193,12 +1201,6 @@ function jobs ()
# phone # phone
if [[ " ${my_array[*]} " == *" PhoneAuthentication "* ]]; then if [[ " ${my_array[*]} " == *" PhoneAuthentication "* ]]; then
if ! check_if_installed libpam-google-authenticator ; then
debconf-apt-progress -- apt-get -y install libpam-google-authenticator
fi
if ! check_if_installed qrencode ; then
debconf-apt-progress -- apt-get -y install qrencode
fi
MergeParameter="keyboard-interactive" MergeParameter="keyboard-interactive"
sed -i "s/^#\?ChallengeResponseAuthentication.*/ChallengeResponseAuthentication yes/" /etc/ssh/sshd_config sed -i "s/^#\?ChallengeResponseAuthentication.*/ChallengeResponseAuthentication yes/" /etc/ssh/sshd_config
sed -i -n '/password updating/{p;:a;N;/@include common-password/!ba;s/.*\n/auth required pam_google_authenticator.so nullok\n/};p' /etc/pam.d/sshd sed -i -n '/password updating/{p;:a;N;/@include common-password/!ba;s/.*\n/auth required pam_google_authenticator.so nullok\n/};p' /etc/pam.d/sshd
...@@ -1258,6 +1260,7 @@ function jobs () ...@@ -1258,6 +1260,7 @@ function jobs ()
;; ;;
esac esac
done done
fi
;; ;;
......
...@@ -185,8 +185,13 @@ function check_status ...@@ -185,8 +185,13 @@ function check_status
LIST+=( "Docker" "Run applications by using containers" "$DOCKER_STATUS") LIST+=( "Docker" "Run applications by using containers" "$DOCKER_STATUS")
# Mayan EDMS docker install # Mayan EDMS docker install
if [[ "$DOCKER_STATUS" == "on" ]]; then
curl --output /dev/null --silent --head --fail http://localhost/authentication/login/?next= curl --output /dev/null --silent --head --fail http://localhost/authentication/login/?next=
MAYAN_STATUS=$([[ $? -eq 0 ]] && echo "on" || echo "off") MAYAN_STATUS=$([[ $? -eq 0 ]] && echo "on" || echo "off")
else
MAYAN_STATUS="off"
fi
LIST+=( "Mayan EDMS" "Electronic vault for your documents" "$MAYAN_STATUS") LIST+=( "Mayan EDMS" "Electronic vault for your documents" "$MAYAN_STATUS")
# ISPconfig # ISPconfig
...@@ -1536,7 +1541,7 @@ while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do ...@@ -1536,7 +1541,7 @@ while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do
((i=i+1)) ((i=i+1))
done done
apt-get -qq -y --no-install-recommends install debconf-utils html2text apt-transport-https dialog whiptail lsb-release bc expect > /dev/null apt-get -qq -y --no-install-recommends install curl debconf-utils html2text apt-transport-https dialog whiptail lsb-release bc expect > /dev/null
# gather some info # gather some info
# #
...@@ -1579,7 +1584,7 @@ while true; do ...@@ -1579,7 +1584,7 @@ while true; do
# cycle trought all install options # cycle trought all install options
i=0 i=0
if ! is_package_manager_running; then
while [ "$i" -lt "$LISTLENGHT" ]; do while [ "$i" -lt "$LISTLENGHT" ]; do
if [[ "$selection" == *Samba* && "$SAMBA_STATUS" != "on" ]]; then if [[ "$selection" == *Samba* && "$SAMBA_STATUS" != "on" ]]; then
...@@ -1702,6 +1707,9 @@ while true; do ...@@ -1702,6 +1707,9 @@ while true; do
i=$[$i+1] i=$[$i+1]
done done
fi
# reread statuses # reread statuses
check_status check_status
done done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment