Skip to contentSkip to conversation

nfqueue library setup requires root

DISCUSSION [email protected] 3 participants 4 messages Dec 29, 2011 – Feb 2, 2012 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,
I launched my application with CAP_NET_ADMIN capability, yet both nfq_unbind_pf and nfq_bind_pf produce an error. When I setuid(0) no error is produced and everything works as expected.
Could you please confirm that Library setup operations require root.
Isn't it a bit misleading that libnetfilter_queue docu states that CAP_NET_ADMIN is required without mentioning root permissions. Would it be possible to do Library Setup with only CAP_NET_ADMIN and without root priviliges in future versions?

#1 lore raw

[email protected] wrote, On 12/29/11 15:00:

Quoted 6 lines

Hi,
I launched my application with CAP_NET_ADMIN capability, yet both nfq_unbind_pf and nfq_bind_pf produce an error. When I setuid(0) no error is produced and everything works as expected.
Could you please confirm that Library setup operations require root.
Isn't it a bit misleading that libnetfilter_queue docu states that CAP_NET_ADMIN is required without mentioning root permissions. Would it be possible to do Library Setup with only CAP_NET_ADMIN and without root priviliges in future versions?

On a host node I didn't need CAP_NET_ADMIN when starting it as root (ie. maybe on my system root already has that cap by default; would make sense).

But on a VPS on the same host node I couldn't get it working yet. It always gives errno=111 (ECONNREFUSED; "Connection refused").

Does yours work in a virtual machine, ie. on a VPS ?

#2 lore raw
Quoted 10 lines · U.Mutlu

[email protected] wrote, On 12/29/11 15:00:

Quoted 6 lines

Hi,
I launched my application with CAP_NET_ADMIN capability, yet both nfq_unbind_pf and nfq_bind_pf produce an error. When I setuid(0) no error is produced and everything works as expected.
Could you please confirm that Library setup operations require root.
Isn't it a bit misleading that libnetfilter_queue docu states that CAP_NET_ADMIN is required without mentioning root permissions. Would it be possible to do Library Setup with only CAP_NET_ADMIN and without root priviliges in future versions?

On a host node I didn't need CAP_NET_ADMIN when starting it as root (ie. maybe on my system root already has that cap by default; would make sense).

Yes, root is fine. You should also get it running with CAP_NET_ADMIN.

Quoted 2 lines

But on a VPS on the same host node I couldn't get it working yet. It always gives errno=111 (ECONNREFUSED; "Connection refused").

This has nothing to do with permissions (in that case you'll hit -EPERM).

Quoted 1 line

Does yours work in a virtual machine, ie. on a VPS ?

By "virtual machine" you mean one linux container (lxc)?

#3 lore raw

Pablo Neira Ayuso wrote, On 02/02/12 19:49:

Quoted 12 lines · U.Mutlu
Quoted 10 lines

[email protected] wrote, On 12/29/11 15:00:

Quoted 6 lines

Hi,
I launched my application with CAP_NET_ADMIN capability, yet both nfq_unbind_pf and nfq_bind_pf produce an error. When I setuid(0) no error is produced and everything works as expected.
Could you please confirm that Library setup operations require root.
Isn't it a bit misleading that libnetfilter_queue docu states that CAP_NET_ADMIN is required without mentioning root permissions. Would it be possible to do Library Setup with only CAP_NET_ADMIN and without root priviliges in future versions?

On a host node I didn't need CAP_NET_ADMIN when starting it as root (ie. maybe on my system root already has that cap by default; would make sense).

Quoted 7 lines

Yes, root is fine. You should also get it running with CAP_NET_ADMIN.

Quoted 2 lines

But on a VPS on the same host node I couldn't get it working yet. It always gives errno=111 (ECONNREFUSED; "Connection refused").

This has nothing to do with permissions (in that case you'll hit -EPERM).

So then why does it bring ECONNREFUSED in the VM,
but works fine on the host node?

Quoted 3 lines
Quoted 1 line

Does yours work in a virtual machine, ie. on a VPS ?

By "virtual machine" you mean one linux container (lxc)?

Yes, exactly. Have you tested it in such a container like LXC or openvz?