Commit graph

3401 commits

Author SHA1 Message Date
Minsoo Choo
94d1731e73 Makefile*: remove powerpcspe
As reported on the freebsd-announce mailing list[1] FreeBSD is
continuing to retire 32-bit support.  Remove powerpcspe from build
infrastructure.

[1] https://lists.freebsd.org/archives/freebsd-announce/2024-February/000117.html

Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
Reviewed by:	jhibbits, emaste
Pull request:	https://github.com/freebsd/freebsd-src/pull/1914
2026-01-09 11:28:43 -05:00
Baptiste Daroussin
65e77d34fd nuageinit: fix test after recent behaviour change
with recent change nuageinit always create a "freebsd" user, if no
users are specified, which means we do need to get the rootdir in the
testsuite containing a group file otherwise pw complains and the tests
fails.
2026-01-08 10:55:27 +01:00
Gonéri Le Bouder
cae280931c nuageinit: set the hostname when user-data is missing
This address the situation reported here
https://github.com/freebsd/freebsd-src/pull/1952#issuecomment-3720210259

The user-data file was missing and the `sethostname` function is never
called. This commit adjusts slightly the logic to avoid the `exit()` call
when the `user-data` file is missing.

MFC After:	1 week
Signed-off-by: Gonéri Le Bouder <goneri@lebouder.net>
Differential Revision:	https://github.com/freebsd/freebsd-src/pull/1953
2026-01-08 10:55:27 +01:00
Gonéri Le Bouder
cbc00fcc2b nuageinit: only create the default user when needed
The "default" user should only be created when:

- the `users` key is missing
- or the `default` string is present in the `users` list

Since the `public_keys` is extracted from the meta-data, this patch has
to slightly adjust the way they are loaded.
The change simplify the logic around the default user SSH key injection.
Both `ssh_authorized_keys` and `public_keys` are handled at the same time.

MFC After:	1 week
Signed-off-by: Gonéri Le Bouder <goneri@lebouder.net>
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1952
2026-01-07 13:29:58 +01:00
Baptiste Daroussin
9ea30bbb0e nuageinit(7): pert mandoc linter
MFC After: 	1 week
2026-01-06 09:25:14 +01:00
Gonéri Le Bouder
402f135370 nuageinit/man: clarify how to enable sudo and doas
Clarify that both `sudo` and `doas` are not part of the base system and
they need to be listed in the `packages` section if the user wants to
enable them.

MFC After: 	1 week
Signed-off-by: Gonéri Le Bouder <goneri@lebouder.net>
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1944
2026-01-06 09:25:14 +01:00
Gonéri Le Bouder
7af8b75201 nuageinit: config2_network support dns service cfg
This change enhances `config2_network()` to honor the DNS
configuration, when it's defined through the `services` section.

The `network_data.json` file can hold DNS configuration at two different
places:
- within a network configuration entry
- or `dns` entry in the `services` section, in this case the configuration is global.

An example of such configuration:

{"links": [{"id": "interface0", "type": "phy",
"ethernet_mac_address": "52:54:00:01:59:03"}], "networks": [{"id": "private-ipv4-0", "type": "ipv4", "link": "interface0",
"ip_address": "192.168.123.5", "netmask": "255.255.255.0", "routes": [{"network": "0.0.0.0", "netmask": "0.0.0.0", "gateway":
"192.168.123.1"}], "network_id": "9e5b1ed9-f5e6-4941-a90f-2e06bab858de", "dns_nameservers": ["192.168.123.1"], "services": [{"type":
 "dns", "address": "192.168.123.1"}]}], "services": [{"type": "dns", "address": "192.168.123.1"}]}

See: https://docs.openstack.org/nova/latest/user/metadata.html

MFC After: 	1 week
Signed-off-by: Gonéri Le Bouder <goneri@lebouder.net>
Pull Request: 	https://github.com/freebsd/freebsd-src/pull/1941
2026-01-06 09:25:14 +01:00
Alex Richardson
86f325711c rtld: silence clang's unterminated-string-initialization warning
Since the initializer is used in other places where we can't just
replace it with a char-by-char initializer, this adds a macro for the
nonstring attribute (match the linuxkpi definition).

Reviewed by:	emaste, jhb
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D52535
2025-12-16 12:21:45 -08:00
Gleb Smirnoff
ddf4f9eda9 ipfw: create "ipfw0" and "ipfwlog0" bpf tapping points without ifnet(9)
As a free bonus the tapping points are now able to match packet direction.

Reviewed by:		ae
Differential Revision:	https://reviews.freebsd.org/D53875
2025-12-15 13:17:23 -08:00
Mark Johnston
9dda51f13c rc.subr: Use the variable we defined to invoke setaudit(8)
Reported by:	gtetlow
Fixes:		39ee24182b ("rc.subr: Support setting the audit user when starting services")
MFC after:	1 week
2025-12-14 15:47:06 +00:00
Cy Schubert
cc1e4aae5a rc.d/ipfilter: ipfilter must be enabled for options to take
Some checks are pending
Cross-build Kernel / amd64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / aarch64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / amd64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / aarch64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / amd64 macos-latest (clang-18) (push) Waiting to run
Cross-build Kernel / aarch64 macos-latest (clang-18) (push) Waiting to run
ipfilter options are erased and reset to default when ipfilter is
disabled. This results in nullifying options from rc.conf that were
previously set.

8d6feaaaa2, which added this code, was incorrect as it was for a bug in
ipfilter 4.2.28 and no longer applies to ipfilter 5.1.2.

Fixes:		8d6feaaaa2
MFC after:	1 day
2025-12-09 16:03:38 -08:00
Cy Schubert
f04b23ce35 rc.d/{ipfilter,ippool}: Fix typo in variable name
MFC after:	1 day
2025-12-09 12:33:26 -08:00
Dag-Erling Smørgrav
e540e8b2c0 noshutdown: Fix startup order
This rc script exists solely to create a file, so have it explicitly
require FILESYSTEMS.  In its current form, it was as likely as not to
end up running before cleanvar, which would undo its work.

MFC after:	3 days
Fixes:		384d976725 ("rc.d: Add precious_machine rc.conf knob to create /var/run/noshutdown")
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D54119
2025-12-08 11:30:10 +01:00
Dag-Erling Smørgrav
6ce227d627 cleanvar: Fix startup order
Instead of having FILESYSTEMS require cleanvar, which doesn't really
make semantic sense, say that cleanvar needs to run before FILESYSTEMS.

MFC after:	3 days
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D54118
2025-12-08 11:30:05 +01:00
Dag-Erling Smørgrav
5242bcff20 rtld-elf: Mark LD_SHOW_AUXV insecure
This prevents dumping the memory layout of setugid processes.

MFC after:	3 days
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D54033
2025-12-03 11:09:51 +01:00
Cy Schubert
d5d005e9bf ipfilter: Load optionlist prior to ippool invocation
As a safety precaution df381bec2d limits ippool hash table size to 1K.
This causes any legitimely large hash table to fail to load. The
htable_size_max ipf tuneable adjusts this but the adjustment is made
in the ipfilter rc script, invoked after the ippool script (because it
depends on ippool). Let's load the ipfilter_optionlist in ippool as well.
ipfilter_optionlist load will also occur in the ipfilter rc script in case
the user uses ipfilter without ippool.

Fixes:		df381bec2d
MFC after:	3 days
2025-11-26 14:26:38 -08:00
George V. Neville-Neil
a8151f196c Add description of the LD_DEBUG environment variable.
Some checks are pending
Cross-build Kernel / amd64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / aarch64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / amd64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / aarch64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / amd64 macos-latest (clang-18) (push) Waiting to run
Cross-build Kernel / aarch64 macos-latest (clang-18) (push) Waiting to run
2025-11-25 09:14:26 -05:00
Konstantin Belousov
0628c252bd rtld: fix powerpc build
In arch_fix_auxv(), remove local variable shadowing the argument,
remove write-only variable, and declare the loop variable.
The wrong patch was committed after series of local reverts and
re-apply.

Fixes:	b2b3d2a962
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2025-11-24 15:53:49 +02:00
Jose Luis Duran
57d25b6333
nuageinit: Add guards against empty user data
Add guards against attempting to process a user data file with an empty
first line or contents.

PR:		290395
Reviewed by:	bapt (earlier), dtxdf, markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D53239
2025-11-22 17:23:20 +00:00
Jose Luis Duran
81af04b081
nuageinit: Silence luacheck warnings and fix typos
No functional change intended.

Reviewed by:	bapt, dtxdf, kevans
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D53238
2025-11-22 17:22:23 +00:00
Konstantin Belousov
b2b3d2a962 rtld-elf: move powerpc-specific auxv compat code into arch hook
Tested by:	Timothy Pearson (tpearson_raptorengineering.com)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D53801
2025-11-21 15:33:17 +02:00
Gordon Bergling
73a026d5e9 nuageinit: Fix a typo in an error message
- s/outout/output/

MFC after:	3 days
2025-11-19 15:28:54 +01:00
Gordon Bergling
58b86e40ce libexec/lua: Fix two typos in the manual pages
- s/environnement/environment/
- s/interger/integer/

MFC after:	3 days
2025-11-19 15:24:30 +01:00
Mark Johnston
39ee24182b rc.subr: Support setting the audit user when starting services
When an unprivileged user restarts a service using, e.g., sudo, the
service runs with the audit user ID set to that of the unprivileged
user.  This can have surprising effects: for instance, a user that
restarts a jail that is running sshd will end up with their UID attached
to all audit logs associated with users who log in via that sshd
instance.  (sshd will set the audit user, but this is disallowed in
jails by default.)

Add support for rc.conf directives which cause rc to override the audit
user.  Specifically, make <name>_audit_user=foo cause the audit user to
be set to "foo" for service <name>.  A plain audit_user=foo directive
causes all services to be started as foo.

Note, like other similar rc features, this feature is limited to rc
services which are run by executing a command.  Shell functions can't be
wrapped this way.

Reviewed by:	0mp
MFC after:	2 weeks
Sponsored by:	Modirum MDPay
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D53747
2025-11-18 16:24:21 +00:00
Mark Johnston
71f6592a01 rc.subr: Remove misguided cpuset usage
When running an rc command, if the target rc script defines
<command>_cmd, e.g., start_cmd=..., then the run_rc_command() executes
that instead of $command.  In general it's a shell function, and
"cpuset -l <n> <shell function>" doesn't work.

Moreover, it doesn't really make sense to run cpuset for anything other
than start_cmd.

Other optional isolation mechanisms (e.g., <name>_fib,
<name>_chroot) are only used when invoking $command directly as part of
the "start" command.  Make <name>_cpuset consistent with everything else
by removing these extraneous cpuset invocations.

Reviewed by:	0mp
MFC after:	2 weeks
Sponsored by:	Modirum MDPay
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D53746
2025-11-18 16:24:21 +00:00
Mark Johnston
7861d051de rc.subr: Try to make svjc option handling a bit easier to read
Specifically, make this code fit in fewer columns:
- deindent cases to conform to the usual style,
- use a local variable to minimize duplication in each case.

No functional change intended.

Reviewed by:	0mp, netchild
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D53754
2025-11-18 16:24:20 +00:00
Jonathan Matthews
4ab2d625e1 nuageinit.7: fix cloud-config header line
This updates the nuageinit man page by aligning mentions of the
cloud-config header line with the cloud-init documentation[0], removing
an unwanted "!" character.

[0] https://docs.cloud-init.io/en/latest/explanation/about-cloud-config.html#how-do-i-create-a-cloud-config-file

Signed-off-by: Jonathan Matthews <freebsd@hello.jonathanmatthews.com>
Differential Revision:	https://reviews.freebsd.org/D53706
2025-11-12 11:24:28 +01:00
Christos Margiolis
ac2aa9e869 rc: virtual_oss: Use required_modules instead of load_kld
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	imp, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D53616
2025-11-11 13:07:36 +01:00
Lexi Winter
87121747de periodic: Move 320.whatis to the mandoc package
This periodic script only makes sense if mandoc is installed, so move
it to the mandoc package like other periodic scripts.

/usr/libexec/makewhatis.local only exists for the enjoyment of this
script, and doesn't work without mandoc installed, so move that as
well.

This change moves files between packages so, until we have a proper
policy on how to handle this in release/stable branches, it should
not be MFC'd.

MFC after:	never
Reviewed by:	ziaee, manu
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53609
2025-11-06 15:20:52 +00:00
Lexi Winter
4b342830ab atf: Move the tests back to the tests package
Commit 9065390ddc moved atf to its own package, but mistakenly moved
the tests as well.  Put the tests back into the test package.

Fixes:	9065390ddc ("packages: Remove the tests-dev package")
MFC after:	1 day
Reviewed by:	emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53594
2025-11-05 21:16:32 +00:00
Simon J. Gerraty
a797702be0 rc.subr set dot_dir and dot_file in dot
Files read by '.' cannot workout for themselves where they are
or what they are called, so set dot_dir and dot_file to pass
this information to them.

Reviewed by:	obrien, stevek
Differential Revision:	https://reviews.freebsd.org/D53476
2025-10-30 11:09:13 -07:00
Dag-Erling Smørgrav
22cff1f3e9 rc.subr: Fix slow shutdown issue
Instead of sleeping after pwait returns, use its new -p option to
obtain the list of processes that still have not terminated.

MFC after:	3 days
PR:		290357
Fixes:		5953e7c984 ("rc.subr: Move the sleep in wait_for_pids")
Reviewed by:	0mp, markj
Differential Revision:	https://reviews.freebsd.org/D53294
2025-10-28 12:57:16 +01:00
Jose Luis Duran
e12ec5f433
Revert "blocklist-helper: Silence a bogus pf warning"
This reverts commit 2347ca21d6.

A fix has been implemented in 99560fe98c ("pfctl: Do not warn if there
is no Ethernet anchor").

Revert this commit to avoid having differences with upstream.

MFC after:	2 days
2025-10-28 11:52:42 +00:00
Jose Luis Duran
6f0942bde7
Revert "blocklistd-helper: Silence another bogus pf warning"
This reverts commit 67ade69eb6.

A fix has been implemented in a943a96a50 ("libpfctl: Fix displaying
deeply nested anchors").

Revert this commit to avoid having differences with upstream.
2025-10-28 11:51:59 +00:00
Jose Luis Duran
79e374217d
blocklist: Fix rcorder(8)
The blocklist daemon depends on a packet filter in order to block.

Add all supported packet filters to the REQUIRE line, not just pf, to
indicate rcorder(8) that it should start after the packet filter service
has started.

While here, change the mode of the rc file to include the executable
bit, just like the rest of the files in the rc.d source directory.

Reviewed by:	0mp
MFC after:	2 days
Differential Revision:	https://reviews.freebsd.org/D53364
2025-10-27 15:46:32 +00:00
Lexi Winter
957715f877 flua: Move to a new flua package
flua is a standalone third-party component that deserves its own
package.  In particular, this means things can use flua without
having to depend on FreeBSD-utilities, which will be useful as
more base utilities use flua.

This saves ~500kB in FreeBSD-utilities for systems which don't
need flua.

MFC after:	3 days
Reviewed by:	kevans
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53161
2025-10-26 02:22:47 +00:00
Jose Luis Duran
67ade69eb6
blocklistd-helper: Silence another bogus pf warning
Some checks are pending
Cross-build Kernel / amd64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / aarch64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / amd64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / aarch64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / amd64 macos-latest (clang-18) (push) Waiting to run
Cross-build Kernel / aarch64 macos-latest (clang-18) (push) Waiting to run
It has been reported as PR 290478.  In the meantime, just sweep under
the carpet.

It is worth noting that neither commit:
2347ca21d6 ("blocklist-helper: Silence a bogus pf warning")
nor this one will be upstreamed, as this is a FreeBSD-specific issue.

PR:		290478
MFC after:	2 days
2025-10-25 23:21:07 +00:00
Cy Schubert
05637c8224 rc: Chase 052211e08c and bfb202c455, remove ifconfig down/up
bfb202c455 addresses the CTRL-EVENT-SCAN-FAILED. Upstream d807e289d
caused FreeBSD regression in driver_bsd.c, which this rc.d patch
worked around. As of bfb202c455 this workaround is no longer needed.

052211e08c implemented this change for wpa_supplicant but not for
hostapd.

Reported by:	avg
MFC after:	3 days
2025-10-21 10:31:23 -07:00
Jose Luis Duran
edadbc6ee9
rc: dmesg: Allow umask to be configurable
Allow umask to be configurable.

Being able to set the umask via an rc variable is useful when setting:

    security.bsd.unprivileged_read_msgbuf=0

As it allows a user to configure:

    dmesg_umask="066"

Without modifying the rc script, and preventing the contents of the
$dmesg_file (/var/run/dmesg.boot) from being publicly readable.

PR:		272552
Reviewed by:	netchild
MFC after:	2 days
Differential Revision:	https://reviews.freebsd.org/D53169
2025-10-18 17:11:49 +00:00
Jose Luis Duran
982d70ca2e
rc.conf: Fix typo interferring -> interfering
Reviewed by:	emaste
MFC after:	2 days
Differential Revision:	https://reviews.freebsd.org/D53168
2025-10-18 17:04:25 +00:00
Lexi Winter
bf84861460 packages: Rename unbound to local-unbound
This more accurately reflects its purpose, and its contents, since
everything in the package is prefixed with "local-".

While here, add a message on upgrade about regenerating the config.

MFC after:	3 seconds
Requested by:	des
Reviewed by:	des
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53056
2025-10-15 13:29:18 +01:00
Jose Luis Duran
2347ca21d6
blocklist-helper: Silence a bogus pf warning
Silence a bogus warning about (an ethernet) anchor not being found.

It has been reported as PR 280516.  In the meantime, just sweep under
the carpet.

Approved by:	emaste (mentor)
MFC after:	2 days
2025-10-12 17:16:12 +00:00
Jose Luis Duran
7238317403
blocklist: Rename blacklist to blocklist
Follow up upstream rename from blacklist to blocklist.

- Old names and rc scripts are still valid, but emitting an ugly warning
- Old firewall rules and anchor names should work, but emitting an ugly
  warning
- Old MK_BLACKLIST* knobs are wired to the new ones

Although care has been taken not to break current configurations, this
is a large patch containing mostly duplicated code.  If issues arise, it
will be swiftly reverted.

Reviewed by:	ivy (pkgbase)
Approved by:	emaste (mentor)
MFC after:	2 days
Relnotes:	yes
2025-10-12 17:14:27 +00:00
Christos Margiolis
188ddc15e5 virtual_oss: Clean up rcorder
sndiod is part of audio/sndio, so we should avoid referencing a port
utility from base.

We should also require NETWORKING for the service to start, since
virtual_oss can be configured to send audio through the network.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	des, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D53019
2025-10-10 15:07:23 +02:00
Mark Johnston
04d47c7cde rc tests: Add a test to check for warnings from rcorder
Reviewed by:	des
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D52954
2025-10-08 12:51:16 +00:00
Mark Johnston
ae6db60ff5 rc: Update dependencies for zpool scripts
After commit 900bc02063, zpool depends on mountcritlocal.  zpoolreguid
and zpoolupgrade depend on zpool and want to run before mountcritcycle,
so we have a pair of cycles.

Update zpoolreguid and zpoolupgrade to avoid this.

Reviewed by:	des
MFC after:	3 days
Fixes:	900bc02063 ("rc.d/zpool: change mountcritlocal dep from BEFORE to REQUIRE")
Differential Revision:	https://reviews.freebsd.org/D52953
2025-10-08 12:50:54 +00:00
Lexi Winter
56f9879c3d libexec/rc/rc.d/Makefile: Use CONFGROUPS.yes
Replace .if statements with CONFGROUPS.${MK_FOO} where possible,
and also sort and re-indent the file for readability.

A couple of more complicated sections don't work with CONFGROUPS.yes
yet, so leave those as they are for now.

MFC after:	1 week
Reviewed by:	imp
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52974
2025-10-08 07:08:31 +01:00
Dag-Erling Smørgrav
ec6ad605ec rc: Improve netwait DAD logic
Disable if IPv6 is not supported, and instead of 10 seconds, default to
one more than the value of net.inet6.ip6.dad_count.

Fixes:		5ead817c3b ("rc: Teach netwait to wait for DAD")
Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D52905
2025-10-05 20:42:33 +02:00
Kyle Evans
d505ef08ff flua: unbreak the build
Local tree pollution let this escape.  *sigh*.

Pointy hat:	kevans
Pointy hat:	kevans
Pointy hat:	kevans
Fixes:	9c7db0931d ("flua: move lposix back into flua for now")
2025-10-04 10:04:35 -05:00
Kyle Evans
bb4167463a nuageinit: require lfs where it's needed
nuageinit largely already did this, but one spot was missed -- add the
necessary require() in to get the module loaded.

Fixes:	b11a5709ec ("flua: kick out the remaining builtin modules")
2025-10-04 08:58:00 -05:00