Compare commits

...

6 Commits

Author SHA1 Message Date
CanbiZ (MickLesk) eb5c6a4d66 Update api.func 2026-04-17 13:41:00 +02:00
CanbiZ (MickLesk) 103ec35b17 fix(build.func): pct create audit — 5 fixes
1. Disable globbing (set -f) around pct create calls to prevent
   passwords containing * or ? from expanding to filenames.

2. Fix TAGS: use semicolons (pct format), prevent duplicate
   community-script prefix, remove trailing separator.

3. Skip keyctl dialog for unprivileged containers — pct always
   forces keyctl=1 for CT_TYPE=1, so the dialog was misleading.

4. Remove dead IPV6_STATIC variable (IPv6 is handled via
   IPV6_ADDR/IPV6_GATE which are properly wired into NET_STRING).

5. Remove dead UDHCPC_FIX variable — set and exported but never
   consumed by any install script.
2026-04-17 13:03:14 +02:00
community-scripts-pr-app[bot] 6070e4fcd2 Update CHANGELOG.md (#13799)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-04-16 20:23:40 +00:00
CanbiZ (MickLesk) 4e89480e8c core: wire ENABLE_MKNOD and ALLOW_MOUNT_FS into LXC features (#13796) 2026-04-16 22:23:15 +02:00
community-scripts-pr-app[bot] 214b0dbcc1 Update CHANGELOG.md (#13790)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-04-16 06:30:51 +00:00
Kyle 062a91d178 Add pnpm as a dependency to ghost-cli install (#13789) 2026-04-16 08:30:21 +02:00
5 changed files with 99 additions and 28 deletions
+14
View File
@@ -442,6 +442,20 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
</details>
## 2026-04-16
### 🚀 Updated Scripts
- #### 🐞 Bug Fixes
- Add pnpm as a dependency to ghost-cli install [@YourFavoriteKyle](https://github.com/YourFavoriteKyle) ([#13789](https://github.com/community-scripts/ProxmoxVE/pull/13789))
### 💾 Core
- #### ✨ New Features
- core: wire ENABLE_MKNOD and ALLOW_MOUNT_FS into LXC features [@MickLesk](https://github.com/MickLesk) ([#13796](https://github.com/community-scripts/ProxmoxVE/pull/13796))
## 2026-04-15
### 🆕 New Scripts
+1 -1
View File
@@ -25,7 +25,7 @@ function update_script() {
check_container_resources
setup_mariadb
NODE_VERSION="22" setup_nodejs
NODE_VERSION="22" NODE_MODULE="pnpm" setup_nodejs
ensure_dependencies git
msg_info "Updating Ghost"
+1 -1
View File
@@ -23,7 +23,7 @@ msg_ok "Installed Dependencies"
setup_mariadb
MARIADB_DB_NAME="ghost" MARIADB_DB_USER="ghostuser" setup_mariadb_db
NODE_VERSION="22" setup_nodejs
NODE_VERSION="22" NODE_MODULE="pnpm" setup_nodejs
msg_info "Installing Ghost CLI"
$STD npm install ghost-cli@latest -g
+25 -10
View File
@@ -344,21 +344,36 @@ explain_exit_code() {
# - Escapes a string for safe JSON embedding
# - Strips ANSI escape sequences and non-printable control characters
# - Handles backslashes, quotes, newlines, tabs, and carriage returns
# - Uses jq when available (guaranteed correct), falls back to awk
# ------------------------------------------------------------------------------
json_escape() {
# Escape a string for safe JSON embedding using awk (handles any input size).
# Pipeline: strip ANSI → remove control chars → escape \ " TAB → join lines with \n
printf '%s' "$1" |
local input
# Pipeline: strip ANSI → remove control chars → escape for JSON
input=$(printf '%s' "$1" |
sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' |
tr -d '\000-\010\013\014\016-\037\177\r' |
tr -d '\000-\010\013\014\016-\037\177\r')
# Prefer jq: guaranteed correct JSON string encoding (handles all edge cases)
if command -v jq &>/dev/null; then
# jq -Rs reads raw stdin as string, outputs JSON-encoded string with quotes.
# We strip the surrounding quotes since the heredoc adds them.
printf '%s' "$input" | jq -Rs '.' | sed 's/^"//;s/"$//'
return
fi
# Fallback: character-by-character processing with awk (avoids gsub replacement pitfalls)
printf '%s' "$input" |
awk '
BEGIN { ORS = "" }
BEGIN { ORS="" }
{
gsub(/\\/, "\\\\") # backslash → \\
gsub(/"/, "\\\"") # double quote → \"
gsub(/\t/, "\\t") # tab → \t
if (NR > 1) printf "\\n"
printf "%s", $0
if (NR > 1) printf "%s", "\\n"
for (i = 1; i <= length($0); i++) {
c = substr($0, i, 1)
if (c == "\\") printf "%s", "\\\\"
else if (c == "\"") printf "%s", "\\\""
else if (c == "\t") printf "%s", "\\t"
else printf "%s", c
}
}'
}
+58 -16
View File
@@ -979,7 +979,6 @@ base_settings() {
fi
IPV6_METHOD=${var_ipv6_method:-"none"}
IPV6_STATIC=${var_ipv6_static:-""}
GATE=${var_gateway:-""}
APT_CACHER=${var_apt_cacher:-""}
APT_CACHER_IP=${var_apt_cacher_ip:-""}
@@ -1015,8 +1014,12 @@ base_settings() {
VLAN=${var_vlan:-""}
SSH=${var_ssh:-"no"}
SSH_AUTHORIZED_KEY=${var_ssh_authorized_key:-""}
UDHCPC_FIX=${var_udhcpc_fix:-""}
TAGS="community-script,${var_tags:-}"
# Build TAGS: ensure community-script prefix, use semicolons (pct format), no duplicates
if [[ "${var_tags:-}" == *community-script* ]]; then
TAGS="${var_tags:-community-script}"
else
TAGS="community-script${var_tags:+;${var_tags}}"
fi
ENABLE_FUSE=${var_fuse:-"${1:-no}"}
ENABLE_TUN=${var_tun:-"${1:-no}"}
@@ -1025,6 +1028,7 @@ base_settings() {
ENABLE_NESTING=${var_nesting:-"1"}
ENABLE_KEYCTL=${var_keyctl:-"0"}
ENABLE_MKNOD=${var_mknod:-"0"}
ALLOW_MOUNT_FS=${var_mount_fs:-""}
PROTECT_CT=${var_protection:-"no"}
CT_TIMEZONE=${var_timezone:-"$timezone"}
[[ "${CT_TIMEZONE:-}" == Etc/* ]] && CT_TIMEZONE="host" # pct doesn't accept Etc/* zones
@@ -1203,6 +1207,18 @@ load_vars_file() {
continue
fi
;;
var_mknod)
if [[ "$var_val" != "0" && "$var_val" != "1" ]]; then
msg_warn "Invalid mknod value '$var_val' in $file (must be 0 or 1), ignoring"
continue
fi
;;
var_mount_fs)
if [[ ! "$var_val" =~ ^[a-zA-Z0-9,]+$ ]]; then
msg_warn "Invalid mount_fs value '$var_val' in $file (comma-separated fs names only, e.g. nfs,cifs), ignoring"
continue
fi
;;
var_ipv6_method)
if [[ "$var_val" != "auto" && "$var_val" != "dhcp" && "$var_val" != "static" && "$var_val" != "none" ]]; then
msg_warn "Invalid IPv6 method '$var_val' in $file (must be auto/dhcp/static/none), ignoring"
@@ -1428,10 +1444,10 @@ get_app_defaults_path() {
if ! declare -p VAR_WHITELIST >/dev/null 2>&1; then
# Note: Removed var_ctid (can only exist once), var_ipv6_static (static IPs are unique)
declare -ag VAR_WHITELIST=(
var_apt_cacher var_apt_cacher_ip var_brg var_cpu var_disk var_fuse var_github_token var_gpu
var_gateway var_hostname var_ipv6_method var_mac var_mtu
var_net var_ns var_os var_pw var_ram var_tags var_tun var_unprivileged
var_verbose var_version var_vlan var_ssh var_ssh_authorized_key var_container_storage var_template_storage
var_apt_cacher var_apt_cacher_ip var_brg var_cpu var_disk var_fuse var_github_token var_gpu var_keyctl
var_gateway var_hostname var_ipv6_method var_mac var_mknod var_mount_fs var_mtu
var_net var_nesting var_ns var_os var_protection var_pw var_ram var_tags var_timezone var_tun var_unprivileged
var_verbose var_version var_vlan var_ssh var_ssh_authorized_key var_container_storage var_template_storage var_searchdomain
)
fi
@@ -1781,7 +1797,12 @@ advanced_settings() {
trap 'tput rmcup 2>/dev/null || true' RETURN
# Initialize defaults
TAGS="community-script;${var_tags:-}"
# Build TAGS: ensure community-script prefix, use semicolons (pct format), no duplicates
if [[ "${var_tags:-}" == *community-script* ]]; then
TAGS="${var_tags:-community-script}"
else
TAGS="community-script${var_tags:+;${var_tags}}"
fi
local STEP=1
local MAX_STEP=28
@@ -2518,6 +2539,13 @@ advanced_settings() {
# STEP 22: Keyctl Support (Docker/systemd)
# ═══════════════════════════════════════════════════════════════════════════
22)
# Keyctl is always required for unprivileged containers — skip dialog
if [[ "$_ct_type" == "1" ]]; then
_enable_keyctl="1"
((STEP++))
continue
fi
local keyctl_default_flag="--defaultno"
[[ "$_enable_keyctl" == "1" ]] && keyctl_default_flag=""
@@ -2525,7 +2553,7 @@ advanced_settings() {
--title "KEYCTL SUPPORT" \
--ok-button "Next" --cancel-button "Back" \
$keyctl_default_flag \
--yesno "\nEnable Keyctl support?\n\nRequired for: Docker containers, systemd-networkd,\nand kernel keyring operations.\n\nNote: Automatically enabled for unprivileged containers.\n\n(App default: ${var_keyctl:-0})" 16 62; then
--yesno "\nEnable Keyctl support?\n\nRequired for: Docker containers, systemd-networkd,\nand kernel keyring operations.\n\n(App default: ${var_keyctl:-0})" 14 62; then
_enable_keyctl="1"
else
if [ $? -eq 1 ]; then
@@ -2711,6 +2739,7 @@ Network:
Features:
FUSE: $_enable_fuse | TUN: $_enable_tun
Nesting: $nesting_desc | Keyctl: $keyctl_desc
Mknod: $([ "$_enable_mknod" == "1" ] && echo Enabled || echo Disabled) | Mount FS: ${_mount_fs:-(none)}
GPU: $_enable_gpu | Protection: $protect_desc
Advanced:
@@ -2780,13 +2809,6 @@ Advanced:
[[ -n "$_mac" ]] && MAC=",hwaddr=$_mac" || MAC=""
[[ -n "$_vlan" ]] && VLAN=",tag=$_vlan" || VLAN=""
# Alpine UDHCPC fix
if [ "$var_os" == "alpine" ] && [ "$NET" == "dhcp" ] && [ -n "$_ns" ]; then
UDHCPC_FIX="yes"
else
UDHCPC_FIX="no"
fi
export UDHCPC_FIX
export SSH_KEYS_FILE
# Exit alternate screen buffer before showing summary (so output remains visible)
@@ -2811,6 +2833,8 @@ Advanced:
echo -e "${CONTAINERTYPE}${BOLD}${DGN}Nesting: ${BGN}$([ "${ENABLE_NESTING:-1}" == "1" ] && echo "Enabled" || echo "Disabled")${CL}"
[[ "${ENABLE_KEYCTL:-0}" == "1" ]] && echo -e "${CONTAINERTYPE}${BOLD}${DGN}Keyctl: ${BGN}Enabled${CL}"
echo -e "${GPU}${BOLD}${DGN}GPU Passthrough: ${BGN}${ENABLE_GPU:-no}${CL}"
[[ "${ENABLE_MKNOD:-0}" == "1" ]] && echo -e "${CONTAINERTYPE}${BOLD}${DGN}Mknod: ${BGN}Enabled${CL}"
[[ -n "${ALLOW_MOUNT_FS:-}" ]] && echo -e "${CONTAINERTYPE}${BOLD}${DGN}Mount FS: ${BGN}${ALLOW_MOUNT_FS}${CL}"
[[ "${PROTECT_CT:-no}" == "yes" || "${PROTECT_CT:-no}" == "1" ]] && echo -e "${CONTAINERTYPE}${BOLD}${DGN}Protection: ${BGN}Enabled${CL}"
[[ -n "${CT_TIMEZONE:-}" ]] && echo -e "${INFO}${BOLD}${DGN}Timezone: ${BGN}$CT_TIMEZONE${CL}"
[[ "$APT_CACHER" == "yes" ]] && echo -e "${INFO}${BOLD}${DGN}APT Cacher: ${BGN}$APT_CACHER_IP${CL}"
@@ -2833,6 +2857,8 @@ Advanced:
log_msg "IPv6: $IPV6_METHOD"
log_msg "FUSE Support: ${ENABLE_FUSE:-no}"
log_msg "Nesting: $([ "${ENABLE_NESTING:-1}" == "1" ] && echo "Enabled" || echo "Disabled")"
log_msg "Mknod: $([ "${ENABLE_MKNOD:-0}" == "1" ] && echo "Enabled" || echo "Disabled")"
[[ -n "${ALLOW_MOUNT_FS:-}" ]] && log_msg "Mount FS: ${ALLOW_MOUNT_FS}"
log_msg "GPU Passthrough: ${ENABLE_GPU:-no}"
log_msg "Verbose Mode: $VERBOSE"
log_msg "Session ID: ${SESSION_ID}"
@@ -3612,6 +3638,18 @@ build_container() {
FEATURES="${FEATURES}fuse=1"
fi
# Mknod support (user configurable via advanced settings)
if [ "${ENABLE_MKNOD:-0}" == "1" ]; then
[ -n "$FEATURES" ] && FEATURES="$FEATURES,"
FEATURES="${FEATURES}mknod=1"
fi
# Mount filesystem types (user configurable via advanced settings)
if [ -n "${ALLOW_MOUNT_FS:-}" ]; then
[ -n "$FEATURES" ] && FEATURES="$FEATURES,"
FEATURES="${FEATURES}mount=${ALLOW_MOUNT_FS//,/;}"
fi
# Build PCT_OPTIONS as string for export
local _func_url
if [ "$var_os" == "alpine" ]; then
@@ -5751,6 +5789,9 @@ create_lxc_container() {
msg_debug "Logfile: $LOGFILE"
# First attempt (PCT_OPTIONS is a multi-line string, use it directly)
# Disable globbing: unquoted $PCT_OPTIONS needs word-splitting but must not glob-expand
# (e.g. passwords containing * or ? would match filenames otherwise)
set -f
if ! pct create "$CTID" "${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE}" $PCT_OPTIONS >"$LOGFILE" 2>&1; then
msg_debug "Container creation failed on ${TEMPLATE_STORAGE}. Checking error..."
@@ -5858,6 +5899,7 @@ create_lxc_container() {
fi
fi # close CTID collision else-branch
fi
set +f # re-enable globbing after pct create block
# Verify container exists (allow up to 10s for pmxcfs sync in clusters)
local _pct_visible=false