mirror of https://github.com/tteck/Proxmox.git
testing argon2
This commit is contained in:
parent
96e5e3db11
commit
cff5e1ee9b
|
@ -59,7 +59,7 @@ function update_script() {
|
|||
CHOICE=$(
|
||||
whiptail --title "SUPPORT" --menu "Select option" 11 58 2 \
|
||||
"1" "Update Vaultwarden" \
|
||||
"2" "Show Admin Token" 3>&2 2>&1 1>&3
|
||||
"2" "Reset Admin-Token" 3>&2 2>&1 1>&3
|
||||
)
|
||||
exit_status=$?
|
||||
if [ $exit_status == 1 ]; then
|
||||
|
@ -73,7 +73,22 @@ function update_script() {
|
|||
exit
|
||||
;;
|
||||
2)
|
||||
whiptail --title "ADMIN TOKEN" --msgbox "$(cat /etc/conf.d/vaultwarden | grep ADMIN_TOKEN | awk '{print substr($2, 13) }')" 7 68
|
||||
NEWTOKEN=$(whiptail --passwordbox "Setup your ADMIN-TOKEN (make it strong)" 10 58 3>&1 1>&2 2>&3)
|
||||
if [[ ! -z "$NEWTOKEN" ]]; then
|
||||
ADMINTOKEN=$(echo -n ${NEWTOKEN} | argon2 "$(openssl rand -base64 32)" -e -id -k 19456 -t 2 -p 1)
|
||||
else
|
||||
exit-script
|
||||
fi
|
||||
cat <<EOF >/etc/conf.d/vaultwarden
|
||||
export DATA_FOLDER=/var/lib/vaultwarden
|
||||
export WEB_VAULT_FOLDER=/var/lib/vaultwarden/web-vault
|
||||
export WEB_VAULT_ENABLED=true
|
||||
export ADMIN_TOKEN='$ADMINTOKEN'
|
||||
export ROCKET_ADDRESS=0.0.0.0
|
||||
EOF
|
||||
sed -i '/admin_token/d' /var/lib/vaultwarden/config.json
|
||||
sed -i "2i\\ \"admin_token\": \"$ADMINTOKEN\"" /var/lib/vaultwarden/config.json
|
||||
rc-service vaultwarden restart
|
||||
clear
|
||||
exit
|
||||
;;
|
||||
|
|
|
@ -14,6 +14,13 @@ network_check
|
|||
update_os
|
||||
default_packages
|
||||
|
||||
NEWTOKEN=$(whiptail --passwordbox "Setup your ADMIN-TOKEN (make it strong)" 10 58 3>&1 1>&2 2>&3)
|
||||
if [[ ! -z "$NEWTOKEN" ]]; then
|
||||
ADMINTOKEN=$(echo -n ${NEWTOKEN} | argon2 "$(openssl rand -base64 32)" -e -id -k 19456 -t 2 -p 1)
|
||||
else
|
||||
exit-script
|
||||
fi
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apk add openssl
|
||||
$STD apk add argon2
|
||||
|
@ -25,9 +32,11 @@ cat <<EOF >/etc/conf.d/vaultwarden
|
|||
export DATA_FOLDER=/var/lib/vaultwarden
|
||||
export WEB_VAULT_FOLDER=/var/lib/vaultwarden/web-vault
|
||||
export WEB_VAULT_ENABLED=true
|
||||
export ADMIN_TOKEN:'$(echo -n "MySecretPassword" | argon2 "$(openssl rand -base64 32)" -e -id -k 19456 -t 2 -p 1)'
|
||||
export ADMIN_TOKEN='$ADMINTOKEN'
|
||||
export ROCKET_ADDRESS=0.0.0.0
|
||||
EOF
|
||||
sed -i '/admin_token/d' /var/lib/vaultwarden/config.json
|
||||
sed -i "2i\\ \"admin_token\": \"$ADMINTOKEN\"" /var/lib/vaultwarden/config.json
|
||||
$STD rc-service vaultwarden start
|
||||
$STD rc-update add vaultwarden default
|
||||
msg_ok "Installed Alpine-Vaultwarden"
|
||||
|
|
|
@ -118,7 +118,7 @@ default_packages() {
|
|||
|
||||
motd_ssh() {
|
||||
echo "export TERM='xterm-256color'" >>/root/.bashrc
|
||||
echo -e "$APPLICATION LXC provided by https://tteck.github.io/Proxmox/\n" >/etc/motd
|
||||
echo -e "$APPLICATION LXC provided by https://nicedevil007.github.io/Proxmox/\n" >/etc/motd
|
||||
if [[ "${SSH_ROOT}" == "yes" ]]; then
|
||||
$STD rc-update add sshd
|
||||
sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config
|
||||
|
|
|
@ -476,6 +476,6 @@ EOF
|
|||
description() {
|
||||
IP=$(pct exec "$CTID" ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1)
|
||||
pct set "$CTID" -description "# ${APP} LXC
|
||||
### https://tteck.github.io/Proxmox/
|
||||
### https://nicedevil007.github.io/Proxmox/
|
||||
<a href='https://ko-fi.com/D1D7EP4GF'><img src='https://img.shields.io/badge/☕-Buy me a coffee-red' /></a>"
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ update_os() {
|
|||
|
||||
motd_ssh() {
|
||||
echo "export TERM='xterm-256color'" >>/root/.bashrc
|
||||
echo -e "$APPLICATION LXC provided by https://tteck.github.io/Proxmox/\n" >/etc/motd
|
||||
echo -e "$APPLICATION LXC provided by https://nicedevil007.github.io/Proxmox/\n" >/etc/motd
|
||||
chmod -x /etc/update-motd.d/*
|
||||
if [[ "${SSH_ROOT}" == "yes" ]]; then
|
||||
sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config
|
||||
|
|
Loading…
Reference in New Issue