diff --git a/tools/addon/coder-code-server.sh b/tools/addon/coder-code-server.sh index 7b126d572..b2f103dc6 100644 --- a/tools/addon/coder-code-server.sh +++ b/tools/addon/coder-code-server.sh @@ -85,12 +85,16 @@ function install() { mkdir -p "${HOME}/.config/code-server/" if [ "$preexisting_config" = false ]; then + CS_PASS=$(random_password 20) cat <"$config_path" bind-addr: 0.0.0.0:8680 -auth: none -password: +auth: password +password: ${CS_PASS} cert: false EOF + chmod 600 "$config_path" + echo -e "Coder Code Server\nPassword: ${CS_PASS}" >~/coder-code-server.creds + chmod 600 ~/coder-code-server.creds fi systemctl enable -q --now code-server@"$USER" systemctl restart code-server@"$USER" @@ -111,7 +115,7 @@ EOF msg_ok "Created update script (/usr/local/bin/update_coder-code-server)" echo -e "${APP} should be reachable by going to the following URL. - ${BL}http://${IP}:8680${CL} \n" + ${BL}http://${IP}:8680${CL} (password in ~/coder-code-server.creds)\n" } # ============================================================================== diff --git a/tools/addon/copyparty.sh b/tools/addon/copyparty.sh index c9f4ebd1d..5b598d91b 100644 --- a/tools/addon/copyparty.sh +++ b/tools/addon/copyparty.sh @@ -151,9 +151,9 @@ function install() { else read -rp "${TAB}Set admin username [admin]: " admin_user admin_user=${admin_user:-admin} - read -rsp "${TAB}Set admin password [community-scripts.org]: " admin_pass + read -rsp "${TAB}Set admin password [random]: " admin_pass echo "" - admin_pass=${admin_pass:-community-scripts.org} + admin_pass=${admin_pass:-$(random_password 20)} msg_ok "Configured with admin user: ${admin_user}" fi @@ -291,8 +291,10 @@ UPDATEEOF msg_ok "Storage: ${BL}${DATA_PATH}${CL}" msg_ok "Config: ${BL}${CONF_PATH}${CL}" if [[ -n "$admin_user" ]]; then + echo -e "Copyparty\nUsername: ${admin_user}\nPassword: ${admin_pass}" >~/copyparty.creds + chmod 600 ~/copyparty.creds echo "" - msg_ok "Login: ${GN}${admin_user}${CL} / ${GN}${admin_pass}${CL}" + msg_ok "Login: ${GN}${admin_user}${CL} (password in ~/copyparty.creds)" fi } diff --git a/tools/addon/filebrowser-quantum.sh b/tools/addon/filebrowser-quantum.sh index 97737bb0e..d5c46f0d2 100644 --- a/tools/addon/filebrowser-quantum.sh +++ b/tools/addon/filebrowser-quantum.sh @@ -140,23 +140,6 @@ if [[ -f "$INSTALL_PATH" ]]; then echo -n "${TAB}Update ${APP}? (y/N): " read -r update_prompt if [[ "${update_prompt,,}" =~ ^(y|yes)$ ]]; then - # Older installs kept the public password in the config, which resets it on every start - if grep -qE '^\s*adminPassword:\s*"?community-scripts\.org"?\s*$' "$CONFIG_PATH" 2>/dev/null; then - msg_info "Replacing the default admin password" - ADMIN_PASS=$(random_password 20) - sed -i -E "s|^(\s*adminPassword:).*|\1 ${ADMIN_PASS}|" "$CONFIG_PATH" - chmod 600 "$CONFIG_PATH" - if [[ "$OS" == "Debian" ]]; then systemctl restart filebrowser.service; else rc-service filebrowser restart &>/dev/null; fi - fq_port=$(awk '/^http:/{h=1} h && /^ port:/{print $2; exit}' "$CONFIG_PATH") - for _ in {1..30}; do - [[ "$(curl -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:${fq_port:-8080}/health")" == "200" ]] && break - sleep 1 - done - sed -i '/^\s*adminPassword:/d' "$CONFIG_PATH" - echo -e "FileBrowser Quantum\nUsername: admin\nPassword: ${ADMIN_PASS}" >~/filebrowser-quantum.creds - chmod 600 ~/filebrowser-quantum.creds - msg_ok "Replaced the default admin password (saved in ~/filebrowser-quantum.creds)" - fi if check_for_gh_release "filebrowser-quantum" "gtsteffaniak/filebrowser"; then msg_info "Updating ${APP}" if ! command -v curl &>/dev/null; then $STD $PKG_MANAGER curl; fi diff --git a/tools/addon/filebrowser.sh b/tools/addon/filebrowser.sh index cd4399a96..17608c350 100644 --- a/tools/addon/filebrowser.sh +++ b/tools/addon/filebrowser.sh @@ -87,20 +87,6 @@ if [ -f "$INSTALL_PATH" ]; then read -r -p "Would you like to update ${APP}? (y/N): " update_prompt if [[ "${update_prompt,,}" =~ ^(y|yes)$ ]]; then - # Older installs created admin with the public password community-scripts.org - fb_port=$(grep -oP '(?<=-p )[0-9]+' "$SERVICE_PATH" 2>/dev/null | head -n1) - fb_db=$(grep -oP '(?<=-d )\S+' "$SERVICE_PATH" 2>/dev/null | head -n1) - [[ -n "$fb_db" ]] || fb_db="$(grep -oP '(?<=^WorkingDirectory=)\S+' "$SERVICE_PATH" 2>/dev/null || echo /root)/filebrowser.db" - if [[ "$(curl -s -o /dev/null -w '%{http_code}' -X POST -H 'Content-Type: application/json' -d '{"username":"admin","password":"community-scripts.org","recaptcha":""}' "http://127.0.0.1:${fb_port:-8080}/api/login")" == "200" ]]; then - msg_info "Replacing the default admin password" - ADMIN_PASS=$(random_password 20) - if [[ "$OS" == "Debian" ]]; then systemctl stop filebrowser; else rc-service filebrowser stop &>/dev/null; fi - $STD filebrowser users update admin --password "$ADMIN_PASS" --database "$fb_db" - if [[ "$OS" == "Debian" ]]; then systemctl start filebrowser; else rc-service filebrowser start &>/dev/null; fi - echo -e "FileBrowser\nUsername: admin\nPassword: ${ADMIN_PASS}" >~/filebrowser.creds - chmod 600 ~/filebrowser.creds - msg_ok "Replaced the default admin password (saved in ~/filebrowser.creds)" - fi if check_for_gh_release "filebrowser" "filebrowser/filebrowser"; then msg_info "Updating ${APP}" fetch_and_deploy_gh_release "filebrowser" "filebrowser/filebrowser" "prebuild" "latest" "/opt/filebrowser-dist" "linux-$(arch_resolve)-filebrowser.tar.gz" @@ -136,7 +122,7 @@ if [[ "${install_prompt,,}" =~ ^(y|yes)$ ]]; then chmod 755 /usr/local/community-scripts touch "$DB_PATH" chown root:root "$DB_PATH" - chmod 644 "$DB_PATH" + chmod 600 "$DB_PATH" msg_ok "Directory created successfully" ADMIN_PASS=$(random_password 20) diff --git a/tools/addon/webmin.sh b/tools/addon/webmin.sh index 2fab3337e..c4178af58 100644 --- a/tools/addon/webmin.sh +++ b/tools/addon/webmin.sh @@ -30,6 +30,7 @@ catch_errors # Initialize all core functions (colors, formatting, icons, STD mode) load_functions +confirm_not_pve_host require_debian_like header_info @@ -49,9 +50,13 @@ msg_ok "Installed Prerequisites" msg_info "Installing ${APP}" fetch_and_deploy_gh_release "webmin" "webmin/webmin" "binary" "latest" "/opt/webmin" "webmin_*_all.deb" -/usr/share/webmin/changepass.pl /etc/webmin root root &>/dev/null +WEBMIN_PASS=$(random_password 20) +/usr/share/webmin/changepass.pl /etc/webmin root "$WEBMIN_PASS" &>/dev/null +echo -e "Webmin\nUsername: root\nPassword: ${WEBMIN_PASS}" >~/webmin.creds +chmod 600 ~/webmin.creds msg_ok "Installed ${APP}" get_lxc_ip echo -e "Successfully Installed!! ${APP} should be reachable by going to ${BL}https://${LOCAL_IP}:10000${CL}" +echo -e "Login: root, password in ~/webmin.creds"