chore: auto-generate secrets in nexusguard-install.sh, remove redundant install.sh
This commit is contained in:
+1
-1
Submodule apps/server-core updated: c6911c6951...70b81b8aab
+24
-21
@@ -103,40 +103,43 @@ cp -r "$DASHBOARD_DIST"/* "$DASHBOARD_DIR/"
|
|||||||
|
|
||||||
# Create config file (only if not exists)
|
# Create config file (only if not exists)
|
||||||
if [ ! -f "$CONF_FILE" ]; then
|
if [ ! -f "$CONF_FILE" ]; then
|
||||||
info "Creating config file..."
|
info "Creating config file with auto-generated secrets..."
|
||||||
|
|
||||||
|
RANDOM_JWT=$(openssl rand -hex 32)
|
||||||
|
RANDOM_SALT=$(openssl rand -hex 32)
|
||||||
|
|
||||||
cat << EOF > "$CONF_FILE"
|
cat << EOF > "$CONF_FILE"
|
||||||
# NexusGuard Configuration
|
# NexusGuard Configuration
|
||||||
# This file is sourced by the server-core and nginx
|
# Generated by install.sh on $(date)
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
export DB_HOST=127.0.0.1
|
DB_HOST=127.0.0.1
|
||||||
export DB_PORT=5432
|
DB_PORT=5432
|
||||||
export DB_USER=nexusguard
|
DB_USER=nexusguard
|
||||||
export DB_PASSWORD=nexusguard
|
DB_PASSWORD=nexusguard
|
||||||
export DB_NAME=nexusguard
|
DB_NAME=nexusguard
|
||||||
|
|
||||||
# Redis
|
# Redis
|
||||||
export REDIS_ADDR=127.0.0.1:6379
|
REDIS_ADDR=127.0.0.1:6379
|
||||||
|
|
||||||
# Security (CHANGE THESE!)
|
# Security (auto-generated)
|
||||||
export JWT_SECRET=change-me-to-a-random-string
|
JWT_SECRET=$RANDOM_JWT
|
||||||
export SERVER_SALT=change-me-to-another-random-string
|
SERVER_SALT=$RANDOM_SALT
|
||||||
|
|
||||||
# Network
|
# Network
|
||||||
export NFTABLES_TABLE=nexusguard
|
NFTABLES_TABLE=nexusguard
|
||||||
export IPAM_POOL=10.8.0.0/16
|
IPAM_POOL=10.8.0.0/16
|
||||||
|
|
||||||
# Server
|
# Server
|
||||||
export GIN_MODE=release
|
GIN_MODE=release
|
||||||
export PORT=$SERVER_PORT
|
PORT=$SERVER_PORT
|
||||||
|
|
||||||
# Dashboard
|
# Dashboard
|
||||||
export API_BASE_URL=http://localhost:$SERVER_PORT/api/v1
|
CORS_ALLOWED_ORIGINS=http://localhost:$WEB_PORT
|
||||||
export WEB_PORT=$WEB_PORT
|
SHARE_LINK_TTL=24h
|
||||||
EOF
|
EOF
|
||||||
chmod 600 "$CONF_FILE"
|
chmod 600 "$CONF_FILE"
|
||||||
warn "Config file created at $CONF_FILE"
|
info "Config file created at $CONF_FILE"
|
||||||
warn "IMPORTANT: Edit $CONF_FILE and set JWT_SECRET and SERVER_SALT!"
|
|
||||||
else
|
else
|
||||||
info "Config file already exists, skipping..."
|
info "Config file already exists, skipping..."
|
||||||
fi
|
fi
|
||||||
@@ -218,5 +221,5 @@ info "Access URL: http://localhost:$WEB_PORT"
|
|||||||
info "Config file: $CONF_FILE"
|
info "Config file: $CONF_FILE"
|
||||||
info "Service status: systemctl status $SERVICE_NAME"
|
info "Service status: systemctl status $SERVICE_NAME"
|
||||||
echo ""
|
echo ""
|
||||||
warn "IMPORTANT: Edit $CONF_FILE to set secure JWT_SECRET and SERVER_SALT values!"
|
info "Secrets were auto-generated. Edit $CONF_FILE to customize if needed."
|
||||||
warn "Then restart the service: systemctl restart $SERVICE_NAME"
|
info "Restart after changes: systemctl restart $SERVICE_NAME"
|
||||||
|
|||||||
Reference in New Issue
Block a user