-
polarian
has anyone done a ssh intermediate install for a FDE encrypted freebsd server
-
polarian
aka, boot freebsd, ssh into it, decrypt the actual OS, then boot that?
-
polarian
if someone has I would be interested in the docs for it
-
polarian
(I am still working on decryption over serial, I just have an idea of testing ssh decryption for serial-less devices)
-
kevans
i'd love to figure out how we make it easy to package up an initrd-like thing for use-cases like that
-
kevans
something stupid simple like I toss dropbear into an initrd to decrypt and kick-off the reroot? that /feels/ right
-
polarian
ANOTHER TALK IDEA!!!
-
polarian
kevans: you could embed a small ssh impl into the second stage loader..
-
polarian
loader-sshd-lua!
-
kevans
we have a hard no on more things for bios loader, and for uefi loader it doesn't even need to be particularly small
-
kevans
minimal dropbear is apparently within 1M and probably not incredibly painful to make build in the stand environment
-
polarian
well with UEFI just enable ssh at boot... although the network config would be complicated wouldn't it...
-
kevans
we allocate ~200M for our ESPs these days and use a tiny fraction of that, even a few MB is a drop in the bucket
-
kevans
tsoome: illumos have a need for anything funky like that? ^
-
polarian
oops crashed my terminal
-
polarian
I wonder how you would even embed dropbear
-
polarian
you would probably want to strip it down as much as possible, but dropbear is already pretty basic...
-
polarian
issue is dropbear adds attack surface, if you add dropbear, and you use openssh for your server, you have to worry about the security of both...
-
kevans
you're 100% not getting openssh into your loader environment any time soon, though
-
kevans
that brings us back to the notion of an initrd :-)
-
polarian
why the initrd?
-
polarian
wouldn't the s2 loader be better?
-
polarian
output the s2 loader, aka the boot menu, over ssh?
-
polarian
then you can also configure the server over ssh as well!
-
polarian
say you do an update, and fuck it, then you can select the snapshot of ROOT/default
-
polarian
well I keep saying stage 2, but in theory, you could output the entire loader, you could have a script which parses your rc.conf, and then copies this over to a config within the ESP which provides the network config for the sshd on boot?
-
polarian
hmm I just realised why this wouldn't work, theres no network knowledge in the loader, I forgot the loader is stupid
-
polarian
bummer :/
-
polarian
kevans: freebsd doesnt have an initrd does it?
-
polarian
I thought the third stage of the loader pretty muich does what Linux would use initrd for?
-
kevans
right, but you can see already where the idea starts to look attractive as an option
-
kevans
most people would just stay with loader, but more interesting use-cases can be served with full kernel support
-
polarian
hmmm
-
polarian
its still not as good as serial access though, moment a remote update fails to boot, and you are away at EuroBSDCon (for example) you would need remote hands
-
kevans
i mean, you'd still get serial into the initrd
-
polarian
I wonder how Linux users do this
-
polarian
how does Linux distros failover the backup initrd?
-
polarian
I know they make a backup initrd, but I never questioned how they failover
-
kevans
i think with a setup like that, you'd just inject the initrd as the next stage after loader and expect it to kexec or reroot depending on how much you care about packaging your production kernel into the initrd
-
polarian
kevans: so let me get your theory correct, you would basically embed a mini freebsd install like a linux initrd which the loader will chainload on boot, this will then have an sshd embedded into it, and be a *mostly* functional freebsd kernel (and basic userspace for recovery?) and then once you enter the passphrase over ssh, it kexec (boots the FDE kernel) and then how does rerooting work?
-
polarian
wouldn't you need to unmount root in order to mount the other root, but then how does the other root mount? a syscall?
-
kevans
if you kexec you don't reroot, and you may not need to kexec if you're OK just having a copy of the kernel unencrypted
-
polarian
linux initrd-style*
-
polarian
sorry
-
polarian
not actually Linux, I meant the style
-
kevans
reroot is a specific concept that already exists, see reboot(8) -r
-
polarian
kevans: is there a downside to kexec?
-
polarian
ooo inteeresting...
-
polarian
hold a minute
-
polarian
in theory this could be done with a RPI pretty easily
-
polarian
install a freebsd install onto the microsd card
-
kevans
kexec brings its own risks, you're relying on the current kernel to leave things in a reasonable state for the next kernel to init
-
polarian
have that run an sshd, then decrypt the partition, mount it somewhere, and then kexec the kernel from it?
-
polarian
hmmm
-
polarian
so kexec not perfect then :/
-
polarian
having your kernel unencrypted is a pretty major attack vector
-
kevans
it's probably fine for most drivers
-
polarian
you could sign the kernel, and check the signature from a signature stored encrypted on the FD
-
polarian
FDE
-
polarian
but by then you could have been pwned (already typed in the passphrase)
-
kevans
well, maybe a pretty major attack vector, right? that's making an assumption about your threat model
-
polarian
however it does allow for detection
-
polarian
kevans: if you are FDE your server, your threat mdoel is someone broke into your home/office and wants to exfiltrate the data on your server
-
kevans
if you care enough then you start with secureboot and use veriexec for next stage verification
-
polarian
that same secure boot which was compromised on many devices, that one? :p
-
polarian
I feel like the loader is a smaller attack vector anyways
-
kevans
"if you are FDE your server" -> you're making bold assumptions about my motivation for doing that
-
polarian
true true
-
polarian
FDE mainly just helps with disposing of the drives after :)
-
kevans
perhaps I don't use ZFS, or I don't like ZFS's native encryption, so I just encrypt the whole thing but the relevant bits are only a fraction of what's encrypted
-
kevans
this is how i do my laptop, for instance
-
polarian
I have long been interested in the idea of embedding the freebsd loader as a coreboot payload :p
-
polarian
likely chainloaded from seabios
-
polarian
you get a few MBs of room on most NOR flash iirc
-
polarian
anyways then you can move the loader to write protected NOR (although the laptop will now only ever boot FreeBSD xD)
-
polarian
read and write*
-
polarian
issue is you can get around this with a SOIC-8 clip, because its currently not possible for any open source hacker to replace bootguard :/
-
kevans
"that same secure boot which was compromised on many devices, that one?" -> from my perspective this isn't necessarily a complete takedown of secureboot; it's still a pretty reasonable idea and working with it still provides reasonable protections against less sophisticated actors
-
polarian
but hey if your attacker has the time to reprogram your hardware, you got bigger issues
-
kevans
yeah, there's also that :-)
-
polarian
although you could swap a SOIC-8 with a WSON-8, solder it to the board, just as an extra fuck you to an attacker
-
polarian
but then updating your loader (say if you rotated your signature key for your boot chain) would be a pain... desoldering the chip, slapping it into a socket, reprogramming it, and resoldering it
-
polarian
kevans: its almost 3am, my brain is just trying to nerd out over anything right now
-
polarian
went offtopic, so kexec/no-kexec doesn't matter too much in the grand scheme of things
-
polarian
which makes me wonder, in theory couldn't you reroot already?
-
kevans
yes, but right now your kernel is on the other side of the wall
-
polarian
in theory, say if you had two partitions, one unencrypted, one geli, you get the loader to boot the unencrypted one, (not sure how, but assume you do), then when this boots, it starts a sshd, you ssh in, you decrypt, and mount the FDE partition, and then reroot?
-
polarian
obviously not as perfect as the initrd idea of yours, but one which can be done without any osdev...
-
polarian
right?
-
kevans
yeah
-
kevans
i mean, initrd has its own flaws
-
polarian
the way I could think of doing it, is running through bsdinstall, then once that reboots you into the unencrypted install, make a partition with the free space, geli it, init zfs, make installworld (no kernel would be needed because you are rerooting) and then you can reroot into the FDE install
-
kevans
and doing it probably wouldn't take that much osdev, just working out the right incantations and then figuring out how you want to construct the image
-
polarian
oh boy, updating such an abomination would be a pain in the arse
-
kevans
imo you just treat it as a disposible artifact
-
polarian
wdym?
-
kevans
ideally you just have a mkinitrd type thing, specify the kernel and some binaries you want to wrap into it and it works out the dependencies somehow
-
polarian
now we are getting linuxy :p
-
kevans
so then whenever you apply an update of any kind, you just blow away the initrd and rebuild it from the running system
-
polarian
~just like Linux!~
-
kevans
is that how they do it?
-
polarian
kevans: yeah they regenerate the initrd every kernel update
-
polarian
their package managers usually have a hook to trigger a inird regen
-
kevans
i don't know that i'd go for an auto-update, personally, but i'm also not advocating it as part of average user's boot chain
-
polarian
anyways when I was talking about the abomination I was talking about my idea... I guess you could have a ufs partition for /boot, and then a ufs partition for / (both unencrypted) then do zfs just for the encrypted volume, and then mount the ufs /boot into /boot on the rerooted install, and then you can make installkernel/make installworld?
-
polarian
or... zroot and zboot :p
-
polarian
and just mount the zfs volume for /boot from the zboot pool into the reroot :p
-
polarian
kevans: sounds like fun!
-
kevans
it used to be the case that one standard setup you could get out of the installer was actually two zpools
-
kevans
one called whatever you name it, one called 'bootpool'
-
kevans
bootpool was just the contents of /boot, and your root pool had a symlink into the bootpool
-
polarian
yeah but your bootpool still needs a root, to boot first, so that you can ssh into the bootpool install, and then reroot?
-
kevans
right, you'd have to expand it a bit for your scheme to work
-
polarian
I should finish my serial debugging first before starting new projects :p
-
kevans
in theory you could probably get away with specifying via kenv an rc replacement that just runs sshd and waits
-
kevans
reaping the benefits of bapt's work
-
polarian
although I should be quick, I might get arrested for freebsd warcrimes for this one :p
-
polarian
kevans: you can hotplug the rc?
-
kevans
you're damn right you can ;)
-
polarian
imagine the blogpost potential for this shit...
-
kevans
-
polarian
so in theory, the bootpool would need an sshd, and geli, and any libs geli depends on?
-
kevans
it is the freebsd way
-
polarian
oh and reboot ofc
-
kevans
yeah, sounds reasonable
-
polarian
sounds like you could shrink that into a few MBs
-
polarian
well maybe more than a few
-
polarian
./boot is 350MB on my lapotp
-
polarian
but the /boot can just be remounted actually anyways
-
kevans
yeah, in a traditional setup you mount both pools and symlink the bootpool into place so you don't have two copies and kldload can still work
-
polarian
better yet, this would be pcbios compatible too!
-
kevans
i'm interested in hearing about how your experiments go if you decide to start fucking with it
-
polarian
why symlink it?
-
polarian
I see no reason I cant just mount the /boot partition from the other pool into the reroot
-
kevans
because you still have to have a /boot path within the bootpool, so you end up with /boot -> /bootpool/boot
-
polarian
hmmm.....
-
polarian
I thought the reroot would unmount that all though?
-
kevans
mounting it there might just work, but I think there was an ordering concern of some sort
-
polarian
> The system kills all processes, unmounts all filesystems,
-
kevans
yes, but then the zpool rc script would probably bring it back depending on how your cache file is setup
-
polarian
but the zpool rc script would mount the zpool partitions no?
-
polarian
oh wait no, it tries to mount all zfs partitions ugh
-
polarian
but if zroot has no /boot...
-
polarian
ah fuck
-
kevans
this is probably where 3:00am starts to be a challenge :-)
-
polarian
so with default zfs partitioning /boot is stored within zroot/ROOT/default
-
polarian
so I would also need to partition off the /boot on the unencrypted install, then it can just mount the zroot's empty /boot dir
-
polarian
on reroot
-
polarian
unless im missing something?
-
polarian
but yeah good point, sleepy time
-
kevans
yeah, i don't know, heh
-
kevans
it's end of day here and i'm running on like 3 hours of sleep, so i'm also losing my ability to reason a bit
-
polarian
hah
-
polarian
goodnight
-
kevans
night
-
_Posterdati_
Reinhilde: on debian it worked, then I installed freebsd for speed
-
_Posterdati_
Reinhilde: I remember I access fan speed with acpi
-
_Posterdati_
which make sense
-
_Posterdati_
secondly I cannot have memtest86 check all memory, it only get half memory and 2 on 4 cpus
-
Reinhilde
On debian you were able to access the fan speed? _Posterdati_
-
_Posterdati_
memtest86 is the image provided by freebsd with pkg
-
_Posterdati_
Reinhilde: yes I was, I had psensor
-
_Posterdati_
Reinhilde: the machine was so slow with debian
-
_Posterdati_
Reinhilde: freebsd performs better on this i5
-
Reinhilde
right
-
Reinhilde
_Posterdati_, you don't have to highlight me with every message
-
Reinhilde
_Posterdati_, it starts to get annoying after about the second message in a row
-
Reinhilde
_Posterdati_, so maybe please don't
-
_Posterdati_
uh ok
-
Reinhilde
right, that out of the way: `pensor` here refers to what? a command? some kernel-related API?
-
Reinhilde
er, `psensor`, s key broken
-
Reinhilde
oh, high level, GUI based sensor reader
-
_Posterdati_
it uses lm-sensors
-
Reinhilde
to my knowledge that is linux-specific. do you know what underlying driver was in use on the linux side to pull that data?
-
_Posterdati_
I do not recall
-
_Posterdati_
acpi for sure, and coretemp
-
_Posterdati_
and some asus specific driver
-
Reinhilde
if you `kldload aibs` as root, does anything show up under `sysctl dev.aibs.` that would be of interest
-
_Posterdati_
sysctl: unknown oid 'dev.aibs'
-
Reinhilde
you already kldload'ed aibs?
-
_Posterdati_
yes
-
Reinhilde
k. then just at a first approximation the driver in question may not exist for freebsd
-
_Posterdati_
ok
-
Reinhilde
what was the motherborad again?
-
_Posterdati_
Asus K55VD
-
_Posterdati_
latest bios 411
-
Reinhilde
wait is this a laptop
-
_Posterdati_
yes it is
-
Reinhilde
try `kldload acpi_asus`
-
_Posterdati_
ok
-
Reinhilde
thouh i'm not sure what that'll do, and the nodes would be under hw.acpi.asus
-
Reinhilde
likely won't give you fan spede access
-
_Posterdati_
same error
-
Reinhilde
nothing at all under `sysctl hw.acpi.asus`?
-
_Posterdati_
nothing
-
Reinhilde
did you install the OS under a BIOS type firmware or UEFI
-
_Posterdati_
this is one of the first laptop with uefi
-
Reinhilde
if the machine can use UEFI but you used BIOS the CSM may be incomplete
-
_Posterdati_
ah
-
_Posterdati_
how can I check that?
-
Reinhilde
are you asking how you can check whether you installed via CSM?
-
Reinhilde
efibootmgr as root would probably error
-
_Posterdati_
it returns indos
-
_Posterdati_
infos
-
_Posterdati_
Boot to FW: false
-
_Posterdati_
BootCurrent: 0000
-
_Posterdati_
Timeout: 0 seconds
-
_Posterdati_
BootOrder: 0000, 0001
-
_Posterdati_
+Boot0000* FreeBSD
-
_Posterdati_
Boot0001* CD/DVD Drive
-
nimaje
please don't paste multi line program output into irc
-
Reinhilde
for long pastes - this one's thankfully over already, use a pastebin, such as debian's pastezone
paste.debian.net
-
_Posterdati_
ok
-
Reinhilde
(there's nothing in the TOS that requires the pastes to be related to a debian irc channel, so it shuold be fine for us here)
-
nimaje
and to see how you booted sysctl machdep.bootmethod
-
_Posterdati_
UEFI
-
_Posterdati_
no idea?
-
Reinhilde
nimaje, ah thank
-
Reinhilde
_Posterdati_, yeah the driver probably doesn't exist. hopefully you're ok without your fan speeds for now
-
_Posterdati_
temps are a bit higher for the cpu
-
Reinhilde
that can happen, it's possible you were finding debian slow because you'd done some scheduler tweaks to keep the cpu colder?
-
_Posterdati_
346 K
-
_Posterdati_
I did nothing
-
_Posterdati_
not even frequency scaling
-
Reinhilde
oily josh teh third of syria palaestina, 73°C?
-
_Posterdati_
yes
-
_Posterdati_
it is a bit high
-
Reinhilde
do you have thermal paste
-
_Posterdati_
yes
-
_Posterdati_
changed six months ago
-
_Posterdati_
fan was cleaned
-
_Posterdati_
and sometimes I use air to flush dust
-
Reinhilde
okay
-
Reinhilde
so the machine just runs hot
-
_Posterdati_
because fan does not change speed
-
_Posterdati_
at boot it goes high
-
_Posterdati_
then slow down during boot
-
_Posterdati_
there are dev.cpu.X.coretemp.tjmax = 105.0C
-
_Posterdati_
but I cannot change it
-
_Posterdati_
it says read only parameter
-
Reinhilde
yes
-
Reinhilde
it is
-
_Posterdati_
now I placed the laptop over a fancoil hatch :)
-
Reinhilde
at that temperature the machine should switch off automatically to protect itself.
-
_Posterdati_
temp is decreasing
-
_Posterdati_
ok
-
_Posterdati_
40 C
-
_Posterdati_
now
-
Reinhilde
should be an acceptable temporary workaround
-
_Posterdati_
:(
-
_Posterdati_
cannot work with it :)
-
Reinhilde
oh
-
_Posterdati_
what is dev.cpu.X.coretemp.delta ?
-
Reinhilde
does `sysctl -d dev.cpu.X.coretemp.delta` tell nothing?
-
_Posterdati_
yes it does
-
_Posterdati_
a changing number from 59 to 63
-
_Posterdati_
now 65
-
Reinhilde
`-d` stands for describe; i seem to recall that delta was meant to be the "delta between current temperature and Tjunction.max"
-
_Posterdati_
Delta between TCC activation and current temperature
-
angry_vincent
is this intel cpu?
-
mike56
hello
-
nimaje
as coretemp is working, it has to be intel, for amd it would be amdtemp
-
angry_vincent
you can't change built tjmax. what i suggest ( if the CPU is 6th or newer generation ) is to set epp to 100 - that's maximum powersave
-
angry_vincent
i.e dev.hwpstate_intel.%cpunumber.epp = 100 ( and then for all cores )
-
angry_vincent
if, then, maximum performance needed i set all to "0"
-
angry_vincent
it works quite well
-
angry_vincent
powerd, as well as powerdxx do not work with hwpstate driver and it is useless to set them, if tried at all
-
dvl
There is no mention here of etcupdate/merging of etc files... How should that happen now with pkgbase?
docs.freebsd.org/en/books/handbook/cutting-edge/#pkgbase
-
nimaje
pkg has a three way merge facility, I think with @config in the plist
-
dvl
nimaje: I believe that three way merge has failed me. I don't know why yet.
dan.langille.org/2026/08/07/freebsd…pdated-overwritten-no-merge-attempt
-
spork_css_
I was absolutely shocked that I couldn't mount a UDF disk image - I burned a few hours on this until I found this bug:
bugs.freebsd.org/bugzilla/show_bug.cgi?id=120989
-
spork_css_
but it looks like someone is working on it now, but really didn't occur to me that something that's been around for so long wasn't supported.
-
spork_css_
you can blame Sylve I guess, because when working on converting a Windows VM from BIOS to UEFI I had to pull things off the windows install DVD and... oops. Had to resort to the mac for that.
-
drathir_tor
spork_css_: probably weak workaround to mount, but assume "7z x" could works there... ;D
-
kevans
dvl: did it drop a /etc/pam.d/sshd.pkg{new,save} file in?
-
kevans
dvl: it does try a three-way merge, but if that fails then it's supposed to install the 'new' version as foo.pkgnew and let you reconcile the differences
-
scoobybejesus
it would be convenient if it told you there are relevant files and to run find /etc /usr/local/etc -name '*.pkgnew' -ls to see the files
-
dvl
kevans: No /etc/pam.d/sshd.pkg{new,save} found. :/
-
dvl
kevans: for any of the jails, on any host.
-
kerneldove
there any way to enlarge the max pf table name limit? 31 chars is tough to squeeze into
-
kerneldove
should really be doubled
-
kevans
scoobybejesus: this cannot happen in /usr/local, but agreed on principle
-
ek
It really should be added to the Handbook documentation. Almost every 3rd party guide/how-to for pkgbase includes it.
-
ek
I'm surprised it's not there already (might just be a lingering needed approval, though)