[Git][root/dbroot/postgresql-sync-config][main] hostname verification added

bpt22 pushed to branch main at Root / DBRoot / PostgreSQL Commits: bb54e8c1 by Bernardo Pavloski Tomasi at 2025-08-01T19:37:27-03:00 hostname verification added - - - - - 1 changed file: - ansible/verify-hostnames.sh Changes: ===================================== ansible/verify-hostnames.sh ===================================== @@ -1,17 +1,29 @@ #!/bin/sh -set -x - pg_hba="$1" # Extrair hostnames não-IP e não-localhost hostnames=$( awk ' - $1 == "hostssl" && - $4 != "" && - $4 != "localhost" && - $4 !~ /^([0-9]{1,3}\.){3}[0-9]{1,3}(\/[0-9]+)?$/ && - $4 !~ /:/ { print $4 } +function is_ipv4(addr) { + return (addr ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(\/[0-9]+)?$/) +} + +$1 == "hostssl" { + addr = $4 + + # Ignora se for vazio, localhost ou conter ":" + if (addr == "" || addr == "localhost" || index(addr, ":") > 0) { + next + } + + # Ignora se for IP (com ou sem máscara) + if (is_ipv4(addr)) { + next + } + + print addr +} ' "$pg_hba" ) View it on GitLab: https://gitlab.c3sl.ufpr.br/root/dbroot/postgresql-sync-config/-/commit/bb54... -- View it on GitLab: https://gitlab.c3sl.ufpr.br/root/dbroot/postgresql-sync-config/-/commit/bb54... You're receiving this email because of your account on gitlab.c3sl.ufpr.br.
participantes (1)
-
bpt22 (@bpt22)