LibrePortal/scripts/webui/webui_update_ssh.sh
librelad 875a60f90f LibrePortal v0.1.0 — initial release
A free, open, self-hosted app platform (GNU AGPLv3): one-click app deploys,
Traefik reverse proxy with automatic SSL, rootless Docker support, gluetun
VPN routing, and a web dashboard to manage it all.

Free & open forever to self-host; optional paid hosted services fund it.
See PROMISE.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-21 20:37:54 +01:00

48 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
updateWebUISSHDetails()
{
isNotice "Updating WebUI SSH configuration..."
local made_updates=false
# Update SSH_HOST from default to actual public IP
if [[ "$CFG_SSH_HOST" == "webui-remote-server.com" ]] || [[ -z "$CFG_SSH_HOST" ]]; then
updateConfigOption "CFG_SSH_HOST" "$public_ip_v4"
checkSuccess "Updated CFG_SSH_HOST to $public_ip_v4"
made_updates=true
fi
# Update SSH_PORT from default to actual SSH port
if [[ "$CFG_SSH_PORT" == "22" ]] || [[ -z "$CFG_SSH_PORT" ]]; then
local SSH_CONFIG="/etc/ssh/sshd_config"
local ssh_port=$(grep "^Port" "$SSH_CONFIG" 2>/dev/null | awk '{print $2}' | head -n1)
local ssh_port=${ssh_port:-22} # Default to 22 if not found
if [[ "$ssh_port" != "22" ]] && [[ -n "$ssh_port" ]]; then
updateConfigOption "CFG_SSH_PORT" "$ssh_port"
checkSuccess "Updated CFG_SSH_PORT to $ssh_port"
made_updates=true
fi
fi
# Update SSH_USERNAME from default to actual sudo user
if [[ "$CFG_SSH_USERNAME" == "webui-your-username" ]] || [[ -z "$CFG_SSH_USERNAME" ]]; then
updateConfigOption "CFG_SSH_USERNAME" "$sudo_user_name"
checkSuccess "Updated CFG_SSH_USERNAME to $sudo_user_name"
made_updates=true
fi
# Update SSH_PASSWORD from default to actual LibrePortal user password
if [[ "$CFG_SSH_PASSWORD" == "webui-your-password" ]] || [[ -z "$CFG_SSH_PASSWORD" ]]; then
updateConfigOption "CFG_SSH_PASSWORD" "$CFG_LIBREPORTAL_USER_PASS"
checkSuccess "Updated CFG_SSH_PASSWORD to $CFG_LIBREPORTAL_USER_PASS"
made_updates=true
fi
if [[ "$made_updates" == "true" ]]; then
isSuccessful "WebUI SSH configuration updated successfully"
else
isNotice "WebUI SSH configuration already up to date"
fi
}