disable ssh when SSH_PORT is unset

master
Girish Ramakrishnan 2016-04-11 10:44:43 -07:00
parent 61b32de1cf
commit 121c517698
2 changed files with 10 additions and 1 deletions

View File

@ -21,7 +21,7 @@ DOMAIN = ##DOMAIN
ROOT_URL = https://%(DOMAIN)s/
HTTP_ADDR =
HTTP_PORT = 3000
DISABLE_SSH = false
DISABLE_SSH = ##DISABLE_SSH
SSH_PORT = ##SSH_PORT
; Landing page for non-logged users, can be "home" or "explore"
LANDING_PAGE = explore

View File

@ -21,12 +21,21 @@ setup_ldap_source() {
fi
}
# SSH_PORT can be unset to disable SSH
disable_ssh="false"
if [[ -z "${SSH_PORT}" ]]; then
echo "SSH disabled"
SSH_PORT=29418 # arbitrary port to keep sshd happy
disable_ssh="false"
fi
sed -e "s/^Port .*/Port ${SSH_PORT}/" \
-e "s/^#ListenAddress .*/ListenAddress 0.0.0.0/" \
/etc/ssh/sshd_config > /run/gogs/sshd_config
sed -e "s/##DOMAIN/${APP_DOMAIN}/g" \
-e "s/##SSH_PORT/${SSH_PORT}/g" \
-e "s/##DISABLE_SSH/${disable_ssh}/g" \
-e "s/##MYSQL_HOST/${MYSQL_HOST}/g" \
-e "s/##MYSQL_PORT/${MYSQL_PORT}/g" \
-e "s/##MYSQL_USERNAME/${MYSQL_USERNAME}/g" \