Firewall Rules, how to clean?

How to clear firewall rules? Accidentally added the address of his subnet x.x.x.x/24 with mask 24 to denylist, and lost access to the web panel with the error Bad Gateway 502

Firezone detected a service crash loop. Taking service down. F or support please email support@firez.one and include a copy of these crash logs.

Server.init/1
2022-05-31_00:44:09.57590 {“Kernel pid terminated”,application_controller,"{application_ start_failure,fz_wall,{{shutdown,{failed_to_start_child,‘Elixir.FzWall.Server’,{#{‘exc eption’ => true,‘struct’ => ‘Elixir.RuntimeError’,message => <<“Invalid CIDR: 10. 3.2.2/24”>>},[{‘Elixir.InetCidr’,‘parse_cidr!’,2,[{file,“lib/inet_cidr.ex”},{line,105 },{error_info,#{module => ‘Elixir.Exception’}}]},{‘Elixir.InetCidr’,parse,2,[{file,“lib /inet_cidr.ex”},{line,21}]},{‘Elixir.FzCommon.FzNet’,standardized_inet,1,[{file,“lib/f z_net.ex”},{line,50}]},{‘Elixir.FzWall.CLI.Live’,add_rule,1,[{file,“lib/fz_wall/cli/li ve.ex”},{line,21}]},{‘Elixir.FzWall.CLI.Live’,’-restore/1-fun-0-’,2,[{file,“lib/fz_wal l/cli/live.ex”},{line,101}]},{‘Elixir.Enum’,’-reduce/3-lists^foldl/2-0-’,3,[{file,“lib /enum.ex”},{line,2396}]},{‘Elixir.FzWall.CLI.Live’,restore,1,[{file,“lib/fz_wall/cli/l ive.ex”},{line,100}]},{‘Elixir.FzWall.Server’,init,1,[{file,“lib/fz_wall/server.ex”}, {line,22}]}]}}},{‘Elixir.FzWall.Application’,start,[normal,[]]}}}"}

Hi,

This is reproducible easily; I have opened this GitHub issue: Network prefix validation - Crash on invalid prefix · Issue #663 · firezone/firezone · GitHub

To remove the broken prefix, connect to the PG DB:

/opt/firezone/embedded/bin/psql \
  -U firezone \
  -d firezone \
  -h localhost \
  -p 15432

You should then be able to query for existing rules:

firezone=# select * from public.rules;
 id | destination | action |        inserted_at         |         updated_at         |                 uuid
----+-------------+--------+----------------------------+----------------------------+--------------------------------------
  1 | 192.0.2.1/24  | accept | 2022-05-31 05:26:53.010403 | 2022-05-31 05:26:53.010403 | 95469f9f-5c50-4dbd-a9fd-ff4afc2c62d1
(1 row)

Delete the relevant rule ID:

firezone=# delete from public.rules where id = 1;
DELETE 1

You can then start firezone:

firezone-ctl start
2 Likes

Thank you friend, it helped! :partying_face: