Bug 217728

Summary: [patch] restrict access to reserved ports in jails
Product: Base System Reporter: Matt Miller <mattm916>
Component: kernAssignee: Allan Jude <allanjude>
Status: Closed FIXED    
Severity: Affects Only Me CC: allanjude, feld, smh
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch to add the allow.reserved_port option to jail(8) none

Description Matt Miller 2017-03-12 17:00:01 UTC
Created attachment 180751 [details]
patch to add the allow.reserved_port option to jail(8)

The attached patch adds a new jail(8) configuration option to deny the use of reserved ports inside jail. This is intended for use in shared-IP jails that set the "ipv4=inherit" option, and would not be useful in VNET-enabled jails. The primary use case is for delegating jail administration to ordinary users who would otherwise not be allowed access to run services reserved ports.

Without this patch, ordinary users who have root privileges inside a shared-IP jail have the ability to run services that potentially conflict with the host, such as SSH or Sendmail.
Comment 1 Mark Felder freebsd_committer freebsd_triage 2017-03-30 15:02:36 UTC
I personally like this idea a lot. Anyone else have feedback?
Comment 2 Allan Jude freebsd_committer freebsd_triage 2017-03-30 15:04:43 UTC
It defaults to allow, to avoid breaking existing jails, so I agree.
Comment 3 Steven Hartland freebsd_committer freebsd_triage 2017-03-30 15:09:52 UTC
LGM
Comment 4 Allan Jude freebsd_committer freebsd_triage 2017-03-30 15:50:39 UTC
https://reviews.freebsd.org/D10202
Comment 5 commit-hook freebsd_committer freebsd_triage 2017-06-06 02:15:19 UTC
A commit references this bug:

Author: allanjude
Date: Tue Jun  6 02:15:01 UTC 2017
New revision: 319611
URL: https://svnweb.freebsd.org/changeset/base/319611

Log:
  Jails: Optionally prevent jailed root from binding to privileged ports

  You may now optionally specify allow.noreserved_ports to prevent root
  inside a jail from using privileged ports (less than 1024)

  PR:		217728
  Submitted by:	Matt Miller <mattm916@pulsar.neomailbox.ch>
  Reviewed by:	jamie, cem, smh
  Relnotes:	yes
  Differential Revision:	https://reviews.freebsd.org/D10202

Changes:
  head/sys/kern/kern_jail.c
  head/sys/sys/jail.h
  head/usr.sbin/jail/jail.8
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2017-08-24 14:12:12 UTC
Committed Tue Jun  6 02:15:01 UTC 2017.