mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 23:21:46 +00:00
Introduce a sysctl that modifies the value of PROT_SOCK.
Add net.ipv4.ip_unprivileged_port_start, which is a per namespace sysctl that denotes the first unprivileged inet port in the namespace. To disable all privileged ports set this to zero. It also checks for overlap with the local port range. The privileged and local range may not overlap. The use case for this change is to allow containerized processes to bind to priviliged ports, but prevent them from ever being allowed to modify their container's network configuration. The latter is accomplished by ensuring that the network namespace is not a child of the user namespace. This modification was needed to allow the container manager to disable a namespace's priviliged port restrictions without exposing control of the network namespace to processes in the user namespace. Signed-off-by: Krister Johansen <kjlx@templeofstupid.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d140199af5
commit
4548b683b7
9 changed files with 86 additions and 12 deletions
|
@ -479,7 +479,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
|
|||
|
||||
snum = ntohs(addr->sin_port);
|
||||
err = -EACCES;
|
||||
if (snum && snum < PROT_SOCK &&
|
||||
if (snum && snum < inet_prot_sock(net) &&
|
||||
!ns_capable(net->user_ns, CAP_NET_BIND_SERVICE))
|
||||
goto out;
|
||||
|
||||
|
@ -1700,6 +1700,9 @@ static __net_init int inet_init_net(struct net *net)
|
|||
net->ipv4.sysctl_ip_default_ttl = IPDEFTTL;
|
||||
net->ipv4.sysctl_ip_dynaddr = 0;
|
||||
net->ipv4.sysctl_ip_early_demux = 1;
|
||||
#ifdef CONFIG_SYSCTL
|
||||
net->ipv4.sysctl_ip_prot_sock = PROT_SOCK;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue