mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-08-24 21:35:42 +02:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e7b7534da | |||
| fd44052fe4 |
@@ -59,8 +59,52 @@ sed -i -e 's/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = ["*"]/' \
|
||||
$STD /opt/netbox/upgrade.sh
|
||||
ln -s /opt/netbox/contrib/netbox-housekeeping.sh /etc/cron.daily/netbox-housekeeping
|
||||
|
||||
mv /opt/netbox/contrib/apache.conf /etc/apache2/sites-available/netbox.conf
|
||||
$STD openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/netbox.key -out /etc/ssl/certs/netbox.crt -subj "/C=US/O=NetBox/OU=Certificate/CN=localhost"
|
||||
cat <<EOF >/etc/apache2/sites-available/netbox.conf
|
||||
<VirtualHost *:80>
|
||||
ProxyPreserveHost On
|
||||
|
||||
Alias /static /opt/netbox/netbox/static
|
||||
|
||||
<Directory /opt/netbox/netbox/static>
|
||||
Options FollowSymLinks MultiViews
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
<Location /static>
|
||||
ProxyPass !
|
||||
</Location>
|
||||
|
||||
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
|
||||
ProxyPass / http://127.0.0.1:8001/
|
||||
ProxyPassReverse / http://127.0.0.1:8001/
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost *:443>
|
||||
ProxyPreserveHost On
|
||||
|
||||
SSLEngine on
|
||||
SSLCertificateFile /etc/ssl/certs/netbox.crt
|
||||
SSLCertificateKeyFile /etc/ssl/private/netbox.key
|
||||
|
||||
Alias /static /opt/netbox/netbox/static
|
||||
|
||||
<Directory /opt/netbox/netbox/static>
|
||||
Options FollowSymLinks MultiViews
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
<Location /static>
|
||||
ProxyPass !
|
||||
</Location>
|
||||
|
||||
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
|
||||
ProxyPass / http://127.0.0.1:8001/
|
||||
ProxyPassReverse / http://127.0.0.1:8001/
|
||||
</VirtualHost>
|
||||
EOF
|
||||
$STD a2enmod ssl proxy proxy_http headers rewrite
|
||||
$STD a2ensite netbox
|
||||
systemctl restart apache2
|
||||
|
||||
+3
-22
@@ -1208,12 +1208,10 @@ base_settings() {
|
||||
# - Used by default_var_settings and app defaults loading
|
||||
# - Only loads whitelisted var_* keys
|
||||
# - Optional force parameter to override existing values (for app defaults)
|
||||
# - Optional protected list preserves genuinely user-exported var_* values
|
||||
# ------------------------------------------------------------------------------
|
||||
load_vars_file() {
|
||||
local file="$1"
|
||||
local force="${2:-no}" # If "yes", override existing variables
|
||||
local protected="${3:-}" # space-separated var_* keys the user genuinely exported before this file loaded; never overwritten
|
||||
local force="${2:-no}" # If "yes", override existing variables
|
||||
[ -f "$file" ] || return 0
|
||||
msg_info "Loading defaults from ${file}"
|
||||
|
||||
@@ -1233,13 +1231,6 @@ load_vars_file() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# Protected check helper (genuinely user-exported vars, see $protected above)
|
||||
_is_protected() {
|
||||
local k="$1" p
|
||||
for p in $protected; do [ "$k" = "$p" ] && return 0; done
|
||||
return 1
|
||||
}
|
||||
|
||||
local line key val
|
||||
while IFS= read -r line || [ -n "$line" ]; do
|
||||
line="${line#"${line%%[![:space:]]*}"}"
|
||||
@@ -1444,19 +1435,9 @@ load_vars_file() {
|
||||
esac
|
||||
fi
|
||||
|
||||
# Set variable: force mode overrides existing, otherwise only set if empty.
|
||||
# Exception: var_cpu/var_ram/var_disk are always applied here (unless the
|
||||
# user genuinely exported them beforehand, per $protected) even though the
|
||||
# app script already declared its own baseline for them - base_settings()
|
||||
# reconciles the final floor against APP_DEFAULT_* afterward, so this file
|
||||
# must be allowed to raise them instead of being silently blocked by the
|
||||
# app's own pre-set value.
|
||||
# Set variable: force mode overrides existing, otherwise only set if empty
|
||||
if [[ "$force" == "yes" ]]; then
|
||||
export "${var_key}=${var_val}"
|
||||
elif _is_protected "$var_key"; then
|
||||
:
|
||||
elif [[ "$var_key" == "var_cpu" || "$var_key" == "var_ram" || "$var_key" == "var_disk" ]]; then
|
||||
export "${var_key}=${var_val}"
|
||||
else
|
||||
[[ -z "${!var_key+x}" ]] && export "${var_key}=${var_val}"
|
||||
fi
|
||||
@@ -1616,7 +1597,7 @@ EOF
|
||||
msg_error "default.vars not found after ensure step"
|
||||
return 252
|
||||
}
|
||||
load_vars_file "$dv" "no" "${!_HARD_ENV[*]}"
|
||||
load_vars_file "$dv"
|
||||
|
||||
# 3) Map var_verbose → VERBOSE
|
||||
if [[ -n "${var_verbose:-}" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user