From nobody Thu Jul 16 01:49:11 2026 X-Original-To: freebsd-hackers@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 4h0wvY4VRWz6lBC5 for ; Thu, 16 Jul 2026 01:49:29 +0000 (UTC) (envelope-from rozhuk.im@gmail.com) Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4h0wvX1xlKz40pD for ; Thu, 16 Jul 2026 01:49:28 +0000 (UTC) (envelope-from rozhuk.im@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20251104 header.b=FTzLN6sJ; spf=pass (mx1.freebsd.org: domain of rozhuk.im@gmail.com designates 2a00:1450:4864:20::32e as permitted sender) smtp.mailfrom=rozhuk.im@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-493f140ca8eso35977145e9.1 for ; Wed, 15 Jul 2026 18:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784166560; x=1784771360; darn=freebsd.org; h=content-transfer-encoding:content-type:mime-version:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=EhofXlqi0BqIDTtklnzIcMCNehhaEu39SHcycW76QHc=; b=FTzLN6sJthLacFvWClsRy526cWsFvw6tiFhbq0SZ68Fh9uaeoqes9flkmvBPLESf2m 5yvweI2G+dvOtJBBKh3PmCGseo5gMLLmL86an8BC/hWYA7fCIi97f8OTTnbJclxaqKnI PO+XisNlr5cj30op8gWw8WbxA0OXVqluO9aznUjjkWm+RZg7JPTyAKTqbcdyntt7Q6iS 6f9xAPu6XSGGzoUzhfCPmnu0ed/NmDCetFlIhpsOBZPs20xFX5LcJ84C8Ocjwssb08xK Ze+5mvphQEg/r05TkVtKUKYnDrj5vS7KQKfWDpgEz6RDFgZoMBM7HrOkC9zsDEnuQTDl YYOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784166560; x=1784771360; h=content-transfer-encoding:content-type:mime-version:message-id :subject:cc:to:date:from:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=EhofXlqi0BqIDTtklnzIcMCNehhaEu39SHcycW76QHc=; b=WGNRXrTdE3BRTk34WKAVdT4JRSFcaFK1FiykaKV/N3gCkoIhF/rzD3cznabjcyJpqK E3GMwsl1oADxDiJiVpVqgVoAuDj8MU1KIgxofWWR0unn+E3WByuvjDb80eeXOfzNve+d Lcc0C+qWOF/j11TdK3zY9cLMNxL3kEjPx1O88VAvukmkM3DbKOBtqASfqmV1H5HxunxI LG3/i6B/J+lbo5FnJ3CrEZVjZAeWaB4DJAglNPvl+YbS1ao846tNRZ3ENwBDikCOV/Cr aVaS1PxdkyJcfSsAfUvXEYWku0N9Q77gBuFEeRjsUitu2moF/MAXKlHNVmbC6/8+41/0 5ikA== X-Gm-Message-State: AOJu0YyutjetVNCZtD2PDPkk5CARGgaRqPVosg0A8r4pBmaU4Aj8DxTK mdWSUFdrMbkfI7YSTwHM+CWEmSxpC3aZtF23ZqxjJ6po5G9UuRqsVmT4+WJYHg== X-Gm-Gg: AfdE7cklSPAtUNEEPs4k8tGz4n77dX5aV/4ict7RkQpY/H5XbPKOxkcFzBMVa+rPuKt VGZ8WPqvNucppT6j/19qDAm9tob4//sEjcvxre+/HDRd7Xv3RSSHQrVgpdjB+Ys6OmBokjV67qC GyU9JVyA2+zzZJiddrRHpo9whpyQ+n4Q+zGJuAqF2l1W5p9bOyS4QpQTqSQA1KlYwSi638Ek1Ap tLjcyaz7PwX5QObS+cbyPi/Bna20C0IXytb5faa0Jwof621B9awhH0QuNCHWkmTdRJxng+ai+HE lOe9vlATPwaHMxwBRirmK+NAgLrVN2OiGKxF1AhwvnOFveGgW7bpprK24EF6Z0tDeoI1aL6LEU3 +3KoD1pqv0wdATLZvLS4V1f7dWPMpsxIqRlFkdcem0LNueJr254nfUdUfliY3kUCxwTUCdKjwc5 zQYMeE X-Received: by 2002:a05:600c:8717:b0:492:7083:e5a with SMTP id 5b1f17b1804b1-49542029c1cmr8431555e9.31.1784166560215; Wed, 15 Jul 2026 18:49:20 -0700 (PDT) Received: from rimwks.local ([2001:470:1f1b:4dc:c0f4:b0fe:1bfa:e09e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f464c9cc3sm21273504f8f.35.2026.07.15.18.49.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2026 18:49:19 -0700 (PDT) From: Rozhuk Ivan X-Google-Original-From: Rozhuk Ivan Date: Thu, 16 Jul 2026 04:49:11 +0300 To: freebsd-hackers@freebsd.org Cc: Rozhuk Ivan Subject: automatic creation of a chroot environment Message-ID: <20260716044911.31a9930d@rimwks.local> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; amd64-portbld-freebsd15.1) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4864::/56]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20251104]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; TAGGED_FROM(0.00)[]; TO_DN_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[gmail.com]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; TAGGED_RCPT(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::32e:from] X-Rspamd-Queue-Id: 4h0wvX1xlKz40pD X-Spamd-Bar: --- Hi! I've been using chroot for a long time to reduce the risk of web application hacking on my server. Some time ago, I decided it was time to automate the creation of chroot environments and create a universal solution for any application/port that would be easily customizable. For simple applications and ports, it usually works with minimal effort, but for complex ones, it takes a bit more tinkering. The current implementation creates a RO chroot, without setuid files, with one user and one group. All RW locations are mounted with noexec and nosuid. This makes escaping such a chroot environment extremely difficult, and webshell and other PHP hacks become impossible. I hope someone finds this useful. https://github.com/rozhuk-im/chroot_env