Score:0

How can I log the UID in UFW log file permanently?

in flag

I have here a debian 10 with installed UFW. I want to know the user or uid of the processes of the connections which are logged by UFW. To log the UID I have add --log-uid to the log rules in /etc/ufw/user.rules:

### LOGGING ###
-A ufw-after-logging-input -j LOG --log-uid --log-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10
-A ufw-after-logging-output -j LOG --log-uid --log-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10
-A ufw-after-logging-forward -j LOG --log-uid --log-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10
-A ufw-logging-deny -m conntrack --ctstate INVALID -j LOG --log-uid --log-prefix "[UFW AUDIT INVALID] " -m limit --limit 3/min --limit-burst 10
-A ufw-logging-deny -j LOG --log-uid --log-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10
-A ufw-logging-allow -j LOG --log-uid --log-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10
-I ufw-before-logging-input -j LOG --log-uid --log-prefix "[UFW AUDIT] " -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10
-I ufw-before-logging-output -j LOG --log-uid --log-prefix "[UFW AUDIT] " -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10
-I ufw-before-logging-forward -j LOG --log-uid --log-prefix "[UFW AUDIT] " -m conntrack --ctstate NEW -m limit --limit 3/min --limit-burst 10
### END LOGGING ###

If I restart ufw (systemctl restart ufw) and look into the /etc/ufw/user.rules my added --log-uid are still there. But after a while this option will be removed automatically and the UFW log output don't contains the UID. So my question is: What is the correct way to add the --log-uid permanently?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.