How to add ufw rules in cubic

Asked by cmd

 How can I add ufw rules ,for example : "ufw default deny outgoing and ufw allow out 25,53,80,110,443/tcp".After every command I enter in cubic,s chroot terminal,I get the following message :

"root@cubic:~# ufw allow out 25,53,80,110,443/tcp
WARN: initcaps
[Errno 2] iptables v1.8.4 (legacy): can't initialize iptables table `filter': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.

Rules updated
Rules updated (v6)"

But if I check with : "ufw status verbose numbered" ,the message is :

"root@cubic:~# ufw status verbose numbered
ERROR: problem running iptables: iptables v1.8.4 (legacy): can't initialize iptables table `filter': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded."

The million dollar question would be : are the rules written inside the chrooted linux or not, because on one side it says "Rules updated" ,but on the other one it says "Error ..... can't initialize iptables table `filter': Permission denied" ?

Question information

Language:
English Edit question
Status:
Solved
For:
Cubic Edit question
Assignee:
No assignee Edit question
Solved by:
cmd
Solved:
Last query:
Last reply:
Revision history for this message
Cubic PPA (cubic-wizard) said :
#1

I suspect this is because the container (Cubic's Terminal environment) uses the Host's network.

In fact, the IP address is the same.

You can see this if you execute...

    ip addr show

...on both the host machine and in Cubic.

I don't have a good answer for you to resolve this issue.

One suggestion I could make is, if you know which files ufw modifies, you could modify those files your self. If those files have already been configured on your host machine, you could copy them into your custom file system in Cubic.

Revision history for this message
cmd (mcskf) said (last edit ):
#2

Thank you for your suggestions ,and thank you Cubic team for this useful software tool.Actually I experimented before with the copying of files from host pc to the chrooted environment.Combining different methods (some suggested here) ,plus ignoring the messages from the terminal in Cubic I can consider this solved.Probably I should do a tutorial somewhere ,with all the things (not only ufw/gufw) ,I have done in Cubic.I really start to love this complex piece of software.

Revision history for this message
Cubic PPA (cubic-wizard) said :
#3

If you create a tutorial, please share the link, or add the steps as an answer to this question, so others can benefit.