💡 Idea for a debugging script 💡
This might already exist for FreeBSD, and if so… let me know!
-
- keeps record of OS core/default settings: loader.conf, rc.conf, sysctl.conf, devfs.rules, login.conf etc
-
- keeps record of file checksum on those OS core files (similar to the app, tripwire)
-
- mode which shows divergence on current state vs known-default state in configs (1) and checksums (2)
-4) mode which tracks the files and their change-sets over time, similar to a zfs snapshot but at a single file-level
- mode which shows divergence on current state vs known-default state in configs (1) and checksums (2)
#freebsd #scripting #programming
@winterschon@bsd.cafe I think 1-3 are covered by
freebsd-update IDS. 4 would be nice to add.In my ideal world, we’d separate out the bits in
/etcthat users touch from the ones that are provided by the system and allow/etcto be a separate ZFS dataset. Unfortunately, the lack of this separation means/etcdoesn’t get mounted if you try because the scripts that mount all of the non-root ZFS datasets are in/etc.@david_chisnall@infosec.exchange @winterschon@bsd.cafe I might be thinking wrong but I’m fairly sure if you took a bunch of snapshots at regular intervals you can use
zfs diffbetween them to track file level changes?It tells you a file has changed, then you did the files that have changed to see the actual changes?
@fwaggle@moodoo.org @winterschon@bsd.cafe Yes, the problem is that this will give changes for the entire boot environment (see problem previously mentioned) when you actually just want config file changes and rollback.
@fwaggle@moodoo.org yes, like that, except necessary for UFS installs without ZFS
@winterschon@bsd.cafe @fwaggle@moodoo.org There really isn’t a reason to use UFS unless your machine has less than 64 MiB of RAM. We should remove it from the installer. If you’re not building an appliance image (in which case you won’t use the installer), UFS is almost certainly the wrong tool for the job.
@david_chisnall@infosec.exchange generally I agree. the only systems where I bother with UFS are embedded devices with minimal ram, read-only systems which load everything into ram at boot (BSD-RP), or devices which are limited to SD or CF flash (storage appliances, some which have a super minimal freebsd image deployed on Dell IDSDM, which then hand-off to multipath LUN for centralized control of the storage nodes), and the less exciting: a few old switches and firewalls that seem to never die.
the general reason that I mentioned UFS in this context is less about systems which don’t use ZFS, rather that the idea for a design of this minimal tool is maintaining portability independent of the underlying FS. which is to say, if ZFS isn’t there, then its snapshot system is not a design consideration. some of those system that I mentioned have needed a lightweight debugging toolkit during the hardware development lifecycle, where the full OS being functional is not yet a concern.
sometimes it’s a case of ZFS tools not yet being available because of a kernel panic, and I want sorta-automated analysis which led up to that stage of failure. it’s tedious to track and report the boot stage options, changes, minutiae differences across ten or twenty rapid reboots. scripting those repetitive tasks along with a remote kgdb hookup to an alt-machine on serial is what I’ve been doing lately, but was hoping there was a pre-made “very simple” test harness tool available for similar purposes.
@david_chisnall@infosec.exchange yes, proper observations there, and a coincidence that you mentioned /etc as a separate dataset. I’ve been splitting that off on some dev machines which do not use the regular installer for setup, for these reasons. Also for /use/local and /usr/local/etc during a post-install automation stage.
I’m not sure if that conflicts with design concerns used in the default installation, but it’s helpful for tracking configuration changes separate from the rest of base.
Now I’m looking at the src involved with freebsd-update 👍🏻
@winterschon@bsd.cafe Oh, does that boot now? It didn’t last time I tried: without /etc mounted, you can’t mount other filesystems. I guess the kernel is doing slightly more for ZFS mounts on boot than it used to (doesn’t work for non-ZFS systems because fstab is in /etc, it used to also not work for ZFS, I think, because something in rc.d was needed to mount additional filesystems).


