|
@@ -9,7 +9,7 @@ setup_ldap_source() {
|
|
|
|
|
|
# Wait for gogs to finish db setup, before we insert ldap source in db
|
|
|
while ! curl --fail http://localhost:3000/healthcheck; do
|
|
|
- echo "Waiting for gogs to come up"
|
|
|
+ echo "=> Waiting for gogs to come up"
|
|
|
sleep 1
|
|
|
done
|
|
|
|
|
@@ -22,9 +22,9 @@ setup_ldap_source() {
|
|
|
|
|
|
if mysql -u"${MYSQL_USERNAME}" -p"${MYSQL_PASSWORD}" -h mysql --database="${MYSQL_DATABASE}" \
|
|
|
-e "REPLACE INTO login_source (id, type, name, is_actived, cfg, created_unix, updated_unix) VALUES (1,2,'cloudron',${ldap_status},'{\"Name\":\"cloudron\",\"Host\":\"${LDAP_SERVER}\",\"Port\":${LDAP_PORT},\"UseSSL\":false,\"SkipVerify\":true,\"BindDN\":\"${LDAP_BIND_DN}\",\"BindPassword\":\"${LDAP_BIND_PASSWORD}\",\"UserBase\":\"${LDAP_USERS_BASE_DN}\",\"AttributeUsername\":\"username\",\"AttributeName\":\"displayname\",\"AttributeSurname\":\"\",\"AttributeMail\":\"mail\",\"Filter\":\"(\\\\u007C(mail=%[1]s)(username=%[1]s))\",\"AdminFilter\":\"(memberof=cn=admins,${LDAP_GROUPS_BASE_DN})\"}','${now}','${now}');"; then
|
|
|
- echo "LDAP Authentication was setup with status ${ldap_status}"
|
|
|
+ echo "=> LDAP Authentication was setup with status ${ldap_status}"
|
|
|
else
|
|
|
- echo "Failed to setup LDAP authentication"
|
|
|
+ echo "=> Failed to setup LDAP authentication"
|
|
|
exit 1
|
|
|
fi
|
|
|
}
|
|
@@ -32,20 +32,20 @@ setup_ldap_source() {
|
|
|
# SSH_PORT can be unset to disable SSH
|
|
|
disable_ssh="false"
|
|
|
if [[ -z "${SSH_PORT:-}" ]]; then
|
|
|
- echo "SSH disabled"
|
|
|
+ echo "=> SSH disabled"
|
|
|
SSH_PORT=29418 # arbitrary port to keep sshd happy
|
|
|
disable_ssh="true"
|
|
|
fi
|
|
|
|
|
|
if [[ ! -f "/app/data/sshd/ssh_host_ed25519_key" ]]; then
|
|
|
- echo "Generating ssh host keys"
|
|
|
+ echo "=> Generating ssh host keys"
|
|
|
mkdir -p /app/data/sshd
|
|
|
ssh-keygen -qt rsa -N '' -f /app/data/sshd/ssh_host_rsa_key
|
|
|
ssh-keygen -qt dsa -N '' -f /app/data/sshd/ssh_host_dsa_key
|
|
|
ssh-keygen -qt ecdsa -N '' -f /app/data/sshd/ssh_host_ecdsa_key
|
|
|
ssh-keygen -qt ed25519 -N '' -f /app/data/sshd/ssh_host_ed25519_key
|
|
|
else
|
|
|
- echo "Reusing existing host keys"
|
|
|
+ echo "=> Reusing existing host keys"
|
|
|
fi
|
|
|
|
|
|
chmod 0600 /app/data/sshd/*_key
|
|
@@ -64,7 +64,7 @@ if ! [ -f /app/data/app.ini ]; then
|
|
|
fi
|
|
|
|
|
|
if [ "$(crudini --get /app/data/app.ini security SECRET_KEY)" == "##SECRET_KEY" ]; then
|
|
|
- echo "Generating new SECRET_KEY"
|
|
|
+ echo "=> Generating new SECRET_KEY"
|
|
|
crudini --set "/app/data/app.ini" security SECRET_KEY $(pwgen -1 -s)
|
|
|
fi
|
|
|
|