mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect.git
synced 2024-11-25 21:11:27 +00:00
Merge pull request 'Encoded Passwords' (#23) from escaped-passwords into master
Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/pulls/23
This commit is contained in:
commit
c155f32d5e
16
nixos-infect
16
nixos-infect
|
@ -5,9 +5,15 @@
|
||||||
set -e -o pipefail
|
set -e -o pipefail
|
||||||
|
|
||||||
makeConf() {
|
makeConf() {
|
||||||
export HASHED_PASSWORD=$( mkpasswd -m sha-512 "$PASSWORD" )
|
|
||||||
# Skip everything if main config already present
|
# Skip everything if main config already present
|
||||||
[[ -e /etc/nixos/configuration.nix ]] && return 0
|
[[ -e /etc/nixos/configuration.nix ]] && return 0
|
||||||
|
if [[ $PASSWORD == null ]]; then
|
||||||
|
export PASSWORD=$(printf $ENCODED_PASSWORD | base64 --decode)
|
||||||
|
fi
|
||||||
|
|
||||||
|
export ESCAPED_PASSWORD=$(printf $ENCODED_PASSWORD | base64 --decode | jq -Rs .)
|
||||||
|
export HASHED_PASSWORD=$( mkpasswd -m sha-512 "$PASSWORD" )
|
||||||
|
|
||||||
# NB <<"EOF" quotes / $ ` in heredocs, <<EOF does not
|
# NB <<"EOF" quotes / $ ` in heredocs, <<EOF does not
|
||||||
mkdir -p /etc/nixos
|
mkdir -p /etc/nixos
|
||||||
|
|
||||||
|
@ -44,8 +50,8 @@ makeConf() {
|
||||||
"hostname": "$HOSTNAME",
|
"hostname": "$HOSTNAME",
|
||||||
"nextcloud": {
|
"nextcloud": {
|
||||||
"enable": true,
|
"enable": true,
|
||||||
"adminPassword": "$PASSWORD",
|
"adminPassword": $ESCAPED_PASSWORD,
|
||||||
"databasePassword": "$PASSWORD"
|
"databasePassword": $ESCAPED_PASSWORD
|
||||||
},
|
},
|
||||||
"gitea": {
|
"gitea": {
|
||||||
"enable": true
|
"enable": true
|
||||||
|
@ -60,7 +66,7 @@ makeConf() {
|
||||||
"enable": true
|
"enable": true
|
||||||
},
|
},
|
||||||
"timezone": "Europe/Uzhgorod",
|
"timezone": "Europe/Uzhgorod",
|
||||||
"resticPassword": "$PASSWORD",
|
"resticPassword": $ESCAPED_PASSWORD,
|
||||||
"username": "$LUSER"
|
"username": "$LUSER"
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
@ -338,7 +344,7 @@ infect() {
|
||||||
[ "$PROVIDER" = "digitalocean" ] && doNetConf=y # digitalocean requires detailed network config to be generated
|
[ "$PROVIDER" = "digitalocean" ] && doNetConf=y # digitalocean requires detailed network config to be generated
|
||||||
|
|
||||||
apt update
|
apt update
|
||||||
apt install -y git tar wget curl whois
|
apt install -y git tar wget curl whois jq
|
||||||
checkEnv
|
checkEnv
|
||||||
prepareEnv
|
prepareEnv
|
||||||
makeSwap # smallest (512MB) droplet needs extra memory!
|
makeSwap # smallest (512MB) droplet needs extra memory!
|
||||||
|
|
Loading…
Reference in a new issue