1
0
mirror of git://f0xx.org/ac/ac-deploy synced 2026-07-29 05:38:25 +03:00

Lab cluster: deploy WG/RSSH on cast01 + compose remote_access from secrets.

Add deploy-remote-access-lab.sh, wire WG/RSSH into compose-lab-backend.php,
and run RA deploy during populate app phase on primary.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Anton Afanasyev
2026-06-24 22:57:28 +02:00
committed by Anton Afanasyeu
parent b47f91b1ab
commit 4d2db29b8b
4 changed files with 129 additions and 4 deletions

View File

@@ -136,6 +136,29 @@ API_BEARER_PHP=""
if [ -n "$API_BEARER_TOKEN" ]; then
API_BEARER_PHP="$(printf '%s' "$API_BEARER_TOKEN" | sed "s/'/\\\\'/g")"
fi
WG_ENDPOINT_CFG="${WG_ENDPOINT:-}"
WG_SERVER_PUBLIC_KEY_CFG="${WG_SERVER_PUBLIC_KEY:-}"
WG_PROVISION="${WG_PROVISION_PEERS:-0}"
if [ -f /etc/wireguard/keys/server.publickey ] && [ -z "$WG_SERVER_PUBLIC_KEY_CFG" ]; then
WG_SERVER_PUBLIC_KEY_CFG="$(cat /etc/wireguard/keys/server.publickey)"
fi
if [ -z "$WG_ENDPOINT_CFG" ] && [ -n "$WG_SERVER_PUBLIC_KEY_CFG" ]; then
WG_ENDPOINT_CFG="${CAST01_HOST:-cast01}.${CAST_DOMAIN:-intra.raptor.org}:51820"
WG_PROVISION=1
fi
WG_PROVISION_PHP=false
RSSH_PROVISION_PHP=false
[ "$WG_PROVISION" = "1" ] && WG_PROVISION_PHP=true
RSSH_BASTION_HOST_CFG="${RSSH_BASTION_HOST:-}"
RSSH_BASTION_PORT_CFG="${RSSH_BASTION_PORT:-22}"
if [ -z "$RSSH_BASTION_HOST_CFG" ] && [ -n "$WG_SERVER_PUBLIC_KEY_CFG" ]; then
RSSH_BASTION_HOST_CFG="${CAST01_HOST:-cast01}.${CAST_DOMAIN:-intra.raptor.org}"
fi
RSSH_PROVISION="${RSSH_PROVISION_USERS:-0}"
if [ -n "$RSSH_BASTION_HOST_CFG" ]; then
RSSH_PROVISION=1
fi
[ "$RSSH_PROVISION" = "1" ] && RSSH_PROVISION_PHP=true
URL_SHORTENER_API_BASE_CFG="${URL_SHORTENER_API_BASE:-${SHORT_LINKS_PUBLIC_BASE}}"
URL_SHORTENER_API_HOST_CFG="${URL_SHORTENER_API_HOST:-}"
mkdir -p "${COMPOSED}/config"
@@ -165,10 +188,27 @@ return [
'rbac' => ['default_company_slug' => 'default', 'default_company_id' => 1],
'analytics' => ['enabled' => false, 'measurement_id' => '', 'debug' => false],
'remote_access' => [
'wg_endpoint' => '',
'wg_server_public_key' => '',
'provision_peers' => false,
'require_wg_tools' => false,
'wg_endpoint' => '${WG_ENDPOINT_CFG}',
'wg_server_public_key' => '${WG_SERVER_PUBLIC_KEY_CFG}',
'wg_interface' => 'wg0',
'wg_server_allowed_ips' => '172.200.2.1/32',
'wg_client_ip_prefix' => '172.200.2.',
'wg_client_ip_min' => 10,
'wg_client_ip_max' => 250,
'wg_set_prefix' => 'sudo -n ',
'provision_peers' => ${WG_PROVISION_PHP:-false},
'require_wg_tools' => ${WG_PROVISION_PHP:-false},
'session_ttl_s' => 3600,
'min_poll_interval_s' => 45,
'rssh' => [
'bastion_host' => '${RSSH_BASTION_HOST_CFG}',
'bastion_port' => ${RSSH_BASTION_PORT_CFG:-22},
'local_forward_port' => 8022,
'remote_port_min' => 18000,
'remote_port_max' => 18999,
'provision_users' => ${RSSH_PROVISION_PHP:-false},
'bastion_user_script' => __DIR__ . '/../scripts/rssh_bastion_user.sh',
],
],
'auth' => [
'encryption_key' => '${AUTH_KEY}',