Skip to content

Commit b8ab2c4

Browse files
committed
Fix NoizDNS binary validation: use file check instead of -help flag
The -help flag output didn't match the grep pattern, causing valid binaries to be rejected. Now validates using file command to confirm it's an ELF executable.
1 parent af8a549 commit b8ab2c4

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

dnstm-setup.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3074,11 +3074,15 @@ ensure_noizdns_binary() {
30743074
print_warn "NoizDNS binary is empty (download may have failed)"
30753075
rm -f /usr/local/bin/noizdns-server
30763076
return 1
3077-
elif timeout 3 /usr/local/bin/noizdns-server -help 2>&1 | grep -qi "usage\|flag\|dnstt\|privkey"; then
3077+
fi
3078+
# Validate: must be an ELF binary for this architecture
3079+
local file_type
3080+
file_type=$(file /usr/local/bin/noizdns-server 2>/dev/null || true)
3081+
if echo "$file_type" | grep -qi "ELF.*executable"; then
30783082
print_ok "NoizDNS server installed and verified"
30793083
return 0
30803084
else
3081-
print_warn "NoizDNS binary downloaded but may be corrupt or wrong architecture"
3085+
print_warn "NoizDNS binary is not a valid executable (got: ${file_type})"
30823086
rm -f /usr/local/bin/noizdns-server
30833087
return 1
30843088
fi

0 commit comments

Comments
 (0)