From nobody Sat Jun 26 19:37:29 2021 X-Original-To: ports-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 ACAB611E45D3 for ; Sat, 26 Jun 2021 19:37:29 +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 4GC3zs4Nnyz3Q3k for ; Sat, 26 Jun 2021 19:37:29 +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 7C1C824983 for ; Sat, 26 Jun 2021 19:37:29 +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 15QJbTJd051332 for ; Sat, 26 Jun 2021 19:37:29 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 15QJbTUV051331 for ports-bugs@FreeBSD.org; Sat, 26 Jun 2021 19:37:29 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: ports-bugs@FreeBSD.org Subject: [Bug 256849] [patch] dns/bind916: Support chrooting when used as samba4(13) DLZ backend Date: Sat, 26 Jun 2021 19:37:29 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: bugzilla.freebsd@omnilan.de X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: mat@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter flagtypes.name attachments.created 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: Ports bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-ports-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports-bugs@freebsd.org X-BeenThere: freebsd-ports-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D256849 Bug ID: 256849 Summary: [patch] dns/bind916: Support chrooting when used as samba4(13) DLZ backend Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: Individual Port(s) Assignee: mat@FreeBSD.org Reporter: bugzilla.freebsd@omnilan.de Flags: maintainer-feedback?(mat@FreeBSD.org) Assignee: mat@FreeBSD.org Created attachment 226063 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D226063&action= =3Dedit Extend rc.d/named to handle chrooting samba4 DLZ dependencies I noticed that running bind9 chrooted when loading samba's DLZ module wasn't supported. Although there's not too much of a security benefit considering the rest of= the jail binaries, for my environment, enclaving the DNS part seemd to be an ea= sy and beneficial step, since the FreeBSD bind9 port already makes chrooting an easy to configure task. Since I was unexpectedly happy with the outcome of my POC this week (using Win10+RSAT to manage user accounts and DNS with jailed samba413 for a single DomainController) I prepared this diff (tested on a FreeBSD 13 jail, only providing kerberos/ldap/dns/rpc (by samba413), not serving any data besides sysvol (GPO)). It turned out that the dlz.so which samba provides needs a hallover lot of other libraries and even pwd.db and other config files, so the diff is not = as small as I expected it to be at firsthand. Please find it attched. It extendends the chroot_autoupdate() function to copy all dependencies nee= ded to sucessfully run bind916 chrooted while still maintainable by RSAT via samba413. As long as you don't define named_chroot_dlzcopy (=3D"/usr/local/lib/samba4/modules/bind9/dlz_bind9_16.so" e.g.) in rc.conf, there's no functional change. If defined, and also set named_chroot, about 15MB libraries will be copied = to the chroot directory. I haven't tested the non-jail (nullfs mount) part, but it's covered and I d= on't expect problems. For the records, here's the relevant part of my jail config to allow this p= atch to do it's job: winadc { ... # This must exactly match your 'named_chrootdir=3D' definition in $path/etc/rc.conf!! $named_chrootdir =3D /enclave/named; mount +=3D "devfs $path${named_chrootdir}/dev devfs rw 0 0"; mount +=3D "$path/var/db/samba4/bind-dns $path${named_chrootdir}/var/db/samba4/bind-dns nullfs rw 0 0"; mount +=3D "$path/var/db/samba4/private/sam.ldb.d $path${named_chrootdir}/var/db/samba4/private/sam.ldb.d nullfs rw 0 0"; exec.created =3D "sh -c 'devfs_rulesets=3D\"/etc/defaults/devfs.rules /etc/devfs.rules\"&& . /etc/rc.subr; devfs_init_rulesets && umount $path${named_chrootdir}/dev 2>/dev/null && devfs_domount $path${named_chrootdir}/dev devfsrules_hide_all && devfs -m $path${named_chrootdir}/dev rule apply path null unhide && devfs -m $path${named_chrootdir}/dev rule apply path random unhide && devfs -m $path${named_chrootdir}/dev rule apply path crypto unhide || exit 1'"; ... } The exec.created part is in use for DLZ/samba unrelated chrooted named(8) j= ail setups too. --=20 You are receiving this mail because: You are the assignee for the bug.=