Client: prevent log lines from being written into wg0.conf
This commit is contained in:
@@ -330,12 +330,19 @@ build_client_interface_address() {
|
||||
write_client_config() {
|
||||
local conf="/etc/wireguard/${WG_INTERFACE}.conf"
|
||||
local dns
|
||||
local include_dns=0
|
||||
|
||||
dns="$CLIENT_DNS"
|
||||
if [[ -z "$dns" ]]; then
|
||||
dns="${SERVER_DNS_REMOTE:-1.1.1.1}"
|
||||
fi
|
||||
|
||||
if command -v resolvconf >/dev/null 2>&1; then
|
||||
include_dns=1
|
||||
else
|
||||
log_warn "Команда resolvconf не найдена. Пропускаю строку DNS в конфиге WireGuard."
|
||||
fi
|
||||
|
||||
if [[ -f "$conf" ]]; then
|
||||
backup_file "$conf"
|
||||
fi
|
||||
@@ -344,10 +351,8 @@ write_client_config() {
|
||||
echo "[Interface]"
|
||||
echo "PrivateKey = $(cat "$CLIENT_PRIV_KEY_PATH")"
|
||||
echo "Address = ${CLIENT_INTERFACE_ADDRESS}"
|
||||
if command -v resolvconf >/dev/null 2>&1; then
|
||||
if ((include_dns)); then
|
||||
echo "DNS = ${dns}"
|
||||
else
|
||||
log_warn "Команда resolvconf не найдена. Пропускаю строку DNS в конфиге WireGuard."
|
||||
fi
|
||||
if [[ -n "$PRE_UP" ]]; then
|
||||
echo "$PRE_UP"
|
||||
|
||||
Reference in New Issue
Block a user