From nobody Wed Oct 13 18:31:57 2021 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A16E817FCAD4 for ; Wed, 13 Oct 2021 18:31:57 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HV1Mx483gz4Z9C for ; Wed, 13 Oct 2021 18:31:57 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F9652CB28 for ; Wed, 13 Oct 2021 18:31:57 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 19DIVvv4041542 for ; Wed, 13 Oct 2021 18:31:57 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 19DIVvne041541 for bugs@FreeBSD.org; Wed, 13 Oct 2021 18:31:57 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 259149] mac_portacl not in affect when running VNET jail Date: Wed, 13 Oct 2021 18:31:57 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 13.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: uros@gruber.si X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D259149 Bug ID: 259149 Summary: mac_portacl not in affect when running VNET jail Product: Base System Version: 13.0-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: uros@gruber.si I was trying to use mac_portacl and initial test on host works as described. sysctl is set as follows security.mac.portacl.rules: uid:1000:tcp:88 security.mac.portacl.port_high: 1023 security.mac.portacl.autoport_exempt: 1 security.mac.portacl.suser_exempt: 1 security.mac.portacl.enabled: 1 While testing with jails I stumble upon weird issue.=20 Using jail with either alias IP or host IP everything seems to work just fi= le. Output from `truss nc -l 88` as non root user sigaction(SIGPIPE,{ SIG_IGN SA_RESTART ss_t },{ SIG_DFL SA_RESTART ss_t }) = =3D 0 (0x0) socket(PF_INET,SOCK_DGRAM|SOCK_CLOEXEC,0) =3D 3 (0x3) close(3) =3D 0 (0x0) socket(PF_INET,SOCK_STREAM,IPPROTO_TCP) =3D 3 (0x3) setsockopt(3,SOL_SOCKET,SO_REUSEPORT,0x7fffffffa7d4,4) =3D 0 (0x0) bind(3,{ AF_INET 0.0.0.0:88 },16) =3D 0 (0x0) listen(3,1) =3D 0 (0x0) After this it started to listen on port 88 jls -nj alias2 devfs_ruleset=3D0 nodying enforce_statfs=3D2 host=3Dnew ip4=3Ddisable ip6= =3Ddisable jid=3D417 linux=3Dnew name=3Dalias2 osreldate=3D1300139 osrelease=3D13.0-RE= LEASE parent=3D0 path=3D/jails/alias2/m persist securelevel=3D-1 sysvmsg=3Dnew sysvsem=3Dnew= sysvshm=3Dnew vnet=3Dinherit allow.chflags allow.nomlock allow.nomount allow.mount.nodevfs allow.mount.nofdescfs allow.mount.nolinprocfs allow.mount.nonullfs allow.mount.noprocfs allow.mount.notmpfs allow.mount.nozfs allow.noquotas allow.raw_sockets allow.noread_msgbuf allow.reserved_ports allow.noset_host= name allow.socket_af allow.suser allow.sysvipc allow.unprivileged_proc_debug children.cur=3D0 children.max=3D0 cpuset.id=3D15 host.domainname=3D"" host.= hostid=3D0 host.hostname=3Dalias2.dev host.hostuuid=3D00000000-0000-0000-0000-00000000= 0000 ip4.addr=3D172.20.0.14 ip4.saddrsel ip6.addr=3D ip6.saddrsel linux.osname= =3DLinux linux.osrelease=3D3.17.0 linux.oss_version=3D198144 But on jail with VNET enabled Output from `truss nc -l 88` as non root user sigaction(SIGPIPE,{ SIG_IGN SA_RESTART ss_t },{ SIG_DFL SA_RESTART ss_t }) = =3D 0 (0x0) socket(PF_INET,SOCK_DGRAM|SOCK_CLOEXEC,0) =3D 3 (0x3) close(3) =3D 0 (0x0) socket(PF_INET,SOCK_STREAM,IPPROTO_TCP) =3D 3 (0x3) setsockopt(3,SOL_SOCKET,SO_REUSEPORT,0x7fffffffa7d4,4) =3D 0 (0x0) bind(3,{ AF_INET 0.0.0.0:88 },16) ERR#13 'Permission denied' close(3) =3D 0 (0x0) jls -nj vnet2 devfs_ruleset=3D0 nodying enforce_statfs=3D2 host=3Dnew ip4=3Dinherit ip6= =3Dinherit jid=3D453 linux=3Dnew name=3Dvnet2 osreldate=3D1300139 osrelease=3D13.0-REL= EASE parent=3D0 path=3D/jails/vnet2/m persist securelevel=3D-1 sysvmsg=3Dnew sysvsem=3Dnew = sysvshm=3Dnew vnet=3Dnew allow.chflags allow.nomlock allow.nomount allow.mount.nodevfs allow.mount.nofdescfs allow.mount.nolinprocfs allow.mount.nonullfs allow.mount.noprocfs allow.mount.notmpfs allow.mount.nozfs allow.noquotas allow.raw_sockets allow.noread_msgbuf allow.reserved_ports allow.noset_host= name allow.socket_af allow.suser allow.sysvipc allow.unprivileged_proc_debug children.cur=3D0 children.max=3D0 cpuset.id=3D5 host.domainname=3D"" host.h= ostid=3D0 host.hostname=3Dvnet2.dev host.hostuuid=3D00000000-0000-0000-0000-000000000= 000 ip4.addr=3D ip4.saddrsel ip6.addr=3D ip6.saddrsel linux.osname=3DLinux linux.osrelease=3D3.17.0 linux.oss_version=3D198144 ifconfig for vnet2 jail lo0: flags=3D8049 metric 0 mtu 16384 options=3D680003 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 inet 127.0.0.1 netmask 0xff000000 groups: lo nd6 options=3D21 pflog0: flags=3D0<> metric 0 mtu 33160 groups: pflog epair0b: flags=3D8843 metric 0 mtu = 1500 options=3D8 ether 02:aa:dd:12:46:0b inet 172.20.0.3 netmask 0xffff0000 broadcast 172.20.255.255 groups: epair media: Ethernet 10Gbase-T (10Gbase-T ) status: active nd6 options=3D29 Same thing works on both for root. Looks like that this port <1024 still applied somehow when using VNET even though mac_portacl is doing it's job on other cases. Expected behaviour for port that is not allowed via mac_portacl throws me t= his sigaction(SIGPIPE,{ SIG_IGN SA_RESTART ss_t },{ SIG_DFL SA_RESTART ss_t }) = =3D 0 (0x0) socket(PF_INET,SOCK_DGRAM|SOCK_CLOEXEC,0) =3D 3 (0x3) close(3) =3D 0 (0x0) socket(PF_INET,SOCK_STREAM,IPPROTO_TCP) =3D 3 (0x3) setsockopt(3,SOL_SOCKET,SO_REUSEPORT,0x7fffffffa7d4,4) =3D 0 (0x0) bind(3,{ AF_INET 0.0.0.0:80 },16) ERR#1 'Operation not permitted' close(3) =3D 0 (0x0) So it's clear that error is not the same as if I try allowed 88 port. Is all this expected behaviour or what could cause this to work differently. --=20 You are receiving this mail because: You are the assignee for the bug.=