From ed33374f6722ea4fc7fa967df111da6f8b507d8d Mon Sep 17 00:00:00 2001 From: icequbes1 <71958531+icequbes1@users.noreply.github.com> Date: Sat, 2 Jan 2021 15:29:58 -0800 Subject: [PATCH] Handle UnicodeError in firewall when resolving hostname --- qubesagent/firewall.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qubesagent/firewall.py b/qubesagent/firewall.py index 50e9065..1f72bf9 100755 --- a/qubesagent/firewall.py +++ b/qubesagent/firewall.py @@ -619,6 +619,9 @@ class NftablesWorker(FirewallWorker): except socket.gaierror as e: raise RuleParseError('Failed to resolve {}: {}'.format( rule['dsthost'], str(e))) + except UnicodeError as e: + raise RuleParseError('Invalid destination {}: {}'.format( + rule['dsthost'], str(e))) nft_rule += ' {} daddr {{ {} }}'.format(ip_match, ', '.join(set(item[4][0] + fullmask for item in addrinfo)))