Using low ports without root, capabilities, CAP_NET_BIND_SERVICE

From: Kenneth Porter (shiva_at_sewingwitch.com)
Date: 11/30/05

  • Next message: Endymion: "Re: Converter from AVI to video DVD format"
    Date: Tue, 29 Nov 2005 15:52:10 -0800
    To: For users of Fedora Core releases <fedora-list@redhat.com>
    
    

    I want to spawn a user process which can use low (< 1024) ports. Googling
    around, I've determined that I need to spawn the process and grant it the
    "capability" of CAP_NET_BIND_SERVICE (from
    /usr/include/linux/capability.h). It looks like I need to use sucap,
    execcap, or setpcaps. I haven't found any good examples showing how to
    actually do this. (The binary is commercial with no source so I can't
    compile in code to do this. At best I can write a wrapper.)

    I tried using setpcaps to give the capability to a known bash process
    running in a second window from a su session, and I get this:

    # setpcaps CAP_NET_BIND_SERVICE=eip 11516
    [caps set to:
    = cap_net_bind_service+eip
    ]
    Failed to set cap's on process `11516': (Operation not permitted)

    What's going wrong? I see from some googling that the kernel may be
    compiled to not give init the CAP_SETPCAP capability. Is that the situation
    with Fedora kernels? Do I need a custom kernel? (I tried the latest kernel
    on FC4 and also on a FC2 box.)

    -- 
    fedora-list mailing list
    fedora-list@redhat.com
    To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
    

  • Next message: Endymion: "Re: Converter from AVI to video DVD format"

    Relevant Pages

    • Re: vsftpd - weird error msg
      ... >> Googling provided nothing on this. ... >> and vsftpd kicked the client off. ... Presumably with the previous kernel, ... > capability module was being loaded automatically. ...
      (Debian-User)
    • Linux 2.6 Kernel Capability LSM Module Local Privilege Elevation
      ... Vulnerable: Linux kernel 2.6.* ... When POSIX Capability LSM module isn't compiled into kernel, ... Capability module into kernel, all existed normal users processes will have ... total Capability privileges of superuser. ...
      (Bugtraq)
    • Re: [RFC] [PATCH] file posix capabilities
      ... bitfield are defined to be zero. ... bit that the kernel doesn't recognize, ... It's extensible (as new capability bits are added, ... not-present bytes and therefore assumed to be zero. ...
      (Linux-Kernel)
    • Re: capget() overflows buffers.
      ... |> The kernel is not crashing, ... It's about app security. ... Not to pick holes in your argument, but libcap *has* always been there. ... Remain source compatible with 32-bit raw legacy capability support. ...
      (Linux-Kernel)
    • [PATCH] security: was "Re: capget() overflows buffers."
      ... |> similarly structured program) has a security related bug in it. ... OK, so by way of summary, the kernel, per se, is *not* broken, but the ... system has been configured with filesystem capability support) the leak ... Source code out there hard-codes a notion of what the ...
      (Linux-Kernel)