mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect.git
synced 2024-11-25 13:01:28 +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
|
||||
|
||||
makeConf() {
|
||||
export HASHED_PASSWORD=$( mkpasswd -m sha-512 "$PASSWORD" )
|
||||
# Skip everything if main config already present
|
||||
[[ -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
|
||||
mkdir -p /etc/nixos
|
||||
|
||||
|
@ -44,8 +50,8 @@ makeConf() {
|
|||
"hostname": "$HOSTNAME",
|
||||
"nextcloud": {
|
||||
"enable": true,
|
||||
"adminPassword": "$PASSWORD",
|
||||
"databasePassword": "$PASSWORD"
|
||||
"adminPassword": $ESCAPED_PASSWORD,
|
||||
"databasePassword": $ESCAPED_PASSWORD
|
||||
},
|
||||
"gitea": {
|
||||
"enable": true
|
||||
|
@ -60,7 +66,7 @@ makeConf() {
|
|||
"enable": true
|
||||
},
|
||||
"timezone": "Europe/Uzhgorod",
|
||||
"resticPassword": "$PASSWORD",
|
||||
"resticPassword": $ESCAPED_PASSWORD,
|
||||
"username": "$LUSER"
|
||||
}
|
||||
EOF
|
||||
|
@ -338,7 +344,7 @@ infect() {
|
|||
[ "$PROVIDER" = "digitalocean" ] && doNetConf=y # digitalocean requires detailed network config to be generated
|
||||
|
||||
apt update
|
||||
apt install -y git tar wget curl whois
|
||||
apt install -y git tar wget curl whois jq
|
||||
checkEnv
|
||||
prepareEnv
|
||||
makeSwap # smallest (512MB) droplet needs extra memory!
|
||||
|
|
Loading…
Reference in a new issue