> 4. you didn't mention which distro you are using

This would be good to know since some distros are using iptables 1.8.x
which has two different backends that are in play. Which distro are you
using and what is the output of `iptables --version`

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to ufw in Ubuntu.
https://bugs.launchpad.net/bugs/1956029

Title:
  ufw remains inactive at boot time

Status in ufw package in Ubuntu:
  Incomplete

Bug description:
  I was advised to start a bug report (Comment 38):
  https://bugs.launchpad.net/ubuntu/+source/ufw/+bug/1726856

  I "ufw enable" then several seconds later networking stops. I have get
  Ubuntu to gracefully power-down using the power-button and then
  gracefully power-up.

  Out of curiosity, is anyone here having this problem wish ufw starting
  up at boot time while also using having fail2ban installed?

  Here is my theory. It takes a while for fail2ban to issue all the
  iptable commands to configure the firewall. When ufw tries to
  initialise there may be a clash or lock held either by an iptables
  instance spawned by fail2ban or an iptables instance spawned by ufw.
  One of them will fail and will quite probably mess-up ufw's rules
  breaking network connectivity.

  This time I waited for fail2ban to finish establishing its iptables
  rules before issuing "ufw enable" and this time round network
  connectivity was not lost.

  How to I ensure that ufw is fully up and initialised BEFORE the
  fail2ban service starts?

  -----
  root@loki:~# ./ufw-diag.sh
  Has python: pass (binary: python3, version: 3.8.10, py3)
  Has iptables: pass
  Has ip6tables: pass

  Has /proc/net/dev: pass
  Has /proc/net/if_inet6: pass

  This script will now attempt to create various rules using the iptables
  and ip6tables commands. This may result in module autoloading (eg, for
  IPv6).
  Proceed with checks (Y/n)?
  == IPv4 ==
  Creating 'ufw-check-requirements'... done
  Inserting RETURN at top of 'ufw-check-requirements'... done
  TCP: pass
  UDP: pass
  destination port: pass
  source port: pass
  ACCEPT: pass
  DROP: pass
  REJECT: pass
  LOG: pass
  hashlimit: pass
  limit: pass
  ctstate (NEW): pass
  ctstate (RELATED): pass
  ctstate (ESTABLISHED): pass
  ctstate (INVALID): pass
  ctstate (new, recent set): pass
  ctstate (new, recent update): pass
  ctstate (new, limit): pass
  interface (input): pass
  interface (output): pass
  multiport: pass
  comment: pass
  addrtype (LOCAL): pass
  addrtype (MULTICAST): pass
  addrtype (BROADCAST): pass
  icmp (destination-unreachable): pass
  icmp (source-quench): pass
  icmp (time-exceeded): pass
  icmp (parameter-problem): pass
  icmp (echo-request): pass

  == IPv6 ==
  Creating 'ufw-check-requirements6'... done
  Inserting RETURN at top of 'ufw-check-requirements6'... done
  TCP: pass
  UDP: pass
  destination port: pass
  source port: pass
  ACCEPT: pass
  DROP: pass
  REJECT: pass
  LOG: pass
  hashlimit: pass
  limit: pass
  ctstate (NEW): pass
  ctstate (RELATED): pass
  ctstate (ESTABLISHED): pass
  ctstate (INVALID): pass
  ctstate (new, recent set): pass
  ctstate (new, recent update): pass
  ctstate (new, limit): pass
  interface (input): pass
  interface (output): pass
  multiport: pass
  comment: pass
  icmpv6 (destination-unreachable): pass
  icmpv6 (packet-too-big): pass
  icmpv6 (time-exceeded): pass
  icmpv6 (parameter-problem): pass
  icmpv6 (echo-request): pass
  icmpv6 with hl (neighbor-solicitation): pass
  icmpv6 with hl (neighbor-advertisement): pass
  icmpv6 with hl (router-solicitation): pass
  icmpv6 with hl (router-advertisement): pass
  ipv6 rt: pass

  All tests passed
  -----
  root@loki:/lib/systemd/system# cat ufw.service
  [Unit]
  Description=Uncomplicated firewall
  Documentation=man:ufw(8)
  DefaultDependencies=no
  Before=network.target
  After=NetworkManager.service

  [Service]
  Type=oneshot
  RemainAfterExit=yes
  ExecStart=/lib/ufw/ufw-init start quiet
  # ExecStartPost=/bin/sleep 10
  ExecStop=/lib/ufw/ufw-init stop

  [Install]
  WantedBy=multi-user.target

  -----
  root@loki:/lib/systemd/system# cat fail2ban.service
  [Unit]
  Description=Fail2Ban Service
  Documentation=man:fail2ban(1)
  After=network.target iptables.service firewalld.service ip6tables.service 
ipset.service nftables.service ufw.service
  PartOf=firewalld.service

  [Service]
  Type=simple
  ExecStartPre=/bin/mkdir -p /run/fail2ban
  ExecStart=/usr/bin/fail2ban-server -xf start
  # if should be logged in systemd journal, use following line or set logtarget 
to sysout in fail2ban.local
  # ExecStart=/usr/bin/fail2ban-server -xf --logtarget=sysout start
  ExecStop=/usr/bin/fail2ban-client stop
  ExecReload=/usr/bin/fail2ban-client reload
  PIDFile=/run/fail2ban/fail2ban.pid
  Restart=on-failure
  RestartPreventExitStatus=0 255

  [Install]
  WantedBy=multi-user.target

  -----
  root@loki:/etc/default# cat ufw
  # /etc/default/ufw
  #

  # Set to yes to apply rules to support IPv6 (no means only IPv6 on loopback
  # accepted). You will need to 'disable' and then 'enable' the firewall for
  # the changes to take affect.
  IPV6=yes

  # Set the default input policy to ACCEPT, DROP, or REJECT. Please note that if
  # you change this you will most likely want to adjust your rules.
  DEFAULT_INPUT_POLICY="DROP"

  # Set the default output policy to ACCEPT, DROP, or REJECT. Please note that 
if
  # you change this you will most likely want to adjust your rules.
  DEFAULT_OUTPUT_POLICY="ACCEPT"

  # Set the default forward policy to ACCEPT, DROP or REJECT.  Please note that
  # if you change this you will most likely want to adjust your rules
  DEFAULT_FORWARD_POLICY="DROP"

  # Set the default application policy to ACCEPT, DROP, REJECT or SKIP. Please
  # note that setting this to ACCEPT may be a security risk. See 'man ufw' for
  # details
  DEFAULT_APPLICATION_POLICY="SKIP"

  # By default, ufw only touches its own chains. Set this to 'yes' to have ufw
  # manage the built-in chains too. Warning: setting this to 'yes' will break
  # non-ufw managed firewall rules
  MANAGE_BUILTINS=no

  #
  # IPT backend
  #
  # only enable if using iptables backend
  IPT_SYSCTL=/etc/ufw/sysctl.conf

  # Extra connection tracking modules to load. IPT_MODULES should typically be
  # empty for new installations and modules added only as needed. See
  # 'CONNECTION HELPERS' from 'man ufw-framework' for details. Complete list can
  # be found in net/netfilter/Kconfig of your kernel source. Some common 
modules:
  # nf_conntrack_irc, nf_nat_irc: DCC (Direct Client to Client) support
  # nf_conntrack_netbios_ns: NetBIOS (samba) client support
  # nf_conntrack_pptp, nf_nat_pptp: PPTP over stateful firewall/NAT
  # nf_conntrack_ftp, nf_nat_ftp: active FTP support
  # nf_conntrack_tftp, nf_nat_tftp: TFTP support (server side)
  # nf_conntrack_sane: sane support
  IPT_MODULES=""

  -----
  root@loki:/etc/ufw# lsb_release -rd
  Description:    Ubuntu 20.04.3 LTS
  Release:        20.04

  -----
  root@loki:/etc/ufw# ufw --version
  ufw 0.36
  Copyright 2008-2015 Canonical Ltd.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ufw/+bug/1956029/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to