Title: ufw firewall rules are somehow autogenerated
Tags: networking;ufw;microk8s
Question: I try to create the following ufw rules:
```ufw default deny
ufw allow 51820/udp comment 'wireguard port'
ufw allow 22/tcp comment 'ssh'
ufw enable
```
but somehow i get alot of different rules as well:
```To                         Action      From
--                         ------      ----
[---]
Anywhere on vxlan.calico   ALLOW       Anywhere                  
Anywhere on cali+          ALLOW       Anywhere 
Anywhere                   ALLOW OUT   Anywhere on vxlan.calico  
Anywhere                   ALLOW OUT   Anywhere on cali+         
Anywhere (v6)              ALLOW OUT   Anywhere (v6) on vxlan.calico
Anywhere (v6)              ALLOW OUT   Anywhere (v6) on cali+  
```
Background information: I installed microk8s ( a mini kubernetes) which installs calico as network.
I rly want to secure my server and avoid open ports to my kubernetes so that it is only reachable via the wireguard vpn.
Can someone help me avoiding this auto created ufw rules?
thanks ;)



Here is another answer: Some packages check for installed firewall and update the specific config even if the firewall is not enabled.
UFW is itself not the firewall, it is a firewall management system (like ```firewalld``` and some others). It keeps the config in ```/etc/ufw``` in two parts. First is the applications, which contains what an application needs from the firewall if it will be allowed. Second are the scripts with the actual configuration if the firewall is enabled.
I don't know the ```microk8s``` package in detail, but I think it finds ```ufw``` installed and writes the needed config in one of the rules files in ```/etc/ufw``` to make sure it is activated on enabling the firewall. Check the rules files for the words ```vxlan.calico``` and ```cali+``` and you will find the base ```iptables``` command which configure the iptables firewall. Or check the ```microk8s``` package install scripts in ```/var/lib/dpkg/info``` to see what it does with ```ufw```.
It's the same I do in case I write a package which needs some firewall config.


{'source': 'StackExchangeDataset', 'subset': 'askubuntu.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2022:00:05/07/22', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<networking><ufw><microk8s>', 'Title': 'ufw firewall rules are somehow autogenerated', 'ViewCount': 239, 'id': 1407250, 'user_AboutMe': '<p>Software Engineer (Java/GWT/Android/Linux)</p>\n', 'user_AccountId': 5565331.0, 'user_DisplayName': 'Friedrich Merza', 'user_Reputation': 1.0, 'user_Views': 0.0, 'user_id': 1593721.0}}