<clever>
copumpkin, ikwildrpepper: yeah, i think nixos just takes a raw attrset, and will merge non-conflicting keys
<clever>
mbrgm: the serviceconfig is weird, mkforce doesnt work on prestart
<clever>
ikwildrpepper: nice
<clever>
ikwildrpepper: 5mins after they asked for the pw, they noticed i had pre-configured the IP and ssh was already up
<clever>
ikwildrpepper: its nixos, i dont think they would be able to figure it out :P
<clever>
ikwildrpepper: i gave them a .vmdk file to replace my vm with, and they asked for the pw so they could apply that
<clever>
eacameron: the datacenter IT guys normaly login manualy via the console, and update the config
<clever>
eacameron: one of the datacenters ive been dealing with lately has similar but worse setup, you need static ip's configured, but it has no metadata service
<clever>
or other methods to install
<clever>
eacameron: it also means you cant mess up the config when using nixos-infect (if you turn off the code thats potentialy buggy)
<clever>
eacameron: yeah, imports = [ ./systemd-digitalocean/module.nix ]; in configuration.nix
<clever>
and if you clone the machine via the DO control panel, it automaticaly gets the right ip, no need for nixos to rebuild things
<clever>
eacameron: i believe you just put the module.nix into imports, and you get an IP, thats it
<clever>
eacameron: cant find it on a github search or chrome history, checking my irc logs now
<clever>
eacameron: hmmm, where was it now....
<clever>
eacameron: yeah
<clever>
so you essentialy control GRUB over the internet
<clever>
and if you do take control, you can pick which generation to kexec, or kexec into the rescue system
<clever>
and if it hits a timeout, it will kexec nixos
<clever>
so on bootup, it runs a custom bootloader, that listens on the network for control
<clever>
eacameron, copumpkin: my second idea, is to make a linux bootloader, that runs as a stripped down kernel+initrd+gui app
<clever>
copumpkin: so you get a very cheap repair ANYTHING option, as long as /boot is intact
<clever>
you essentialy are embeding the install cd in /boot
<clever>
this can also be of use for local systems
<clever>
so when it breaks, you open a ticket and tell them to boot the rescue option, then you can ssh into that and repair it
<clever>
#1 (for datacenters with more manual stuff), put the kernel/initrd from my kexec tool into /boot and grub.cfg
<clever>
but this goes into 2 more ideas i had this week
<clever>
in the case of DO, it doesnt sound like they have any tools to allow recovery
<clever>
eacameron: i would expect that to sanely fail when it encounters luks and skip it
<clever>
eacameron: ive heard that when you clone a droplet, DO will try to mount the rootfs, and overwrite /etc/network/interfaces and /root/.ssh/authorized_keys
<clever>
eacameron: then you can ssh into that, and do whatever you want to the hdd
<clever>
eacameron: but with the kexec tool i linked, you can boot nixos in ram, without any changes to the MBR
<clever>
eacameron: so you are forced to keep whatever partitions DO made for you
<clever>
eacameron: and then builds nixos under ubuntu, and overwrites the MBR
<clever>
eacameron: and this script appears to do the same thing i did to a gentoo system, it just jams nix onto the box with curl https://nixos.org/nix/install
<clever>
eacameron: and somebody else in #nixos wrote a module that properly queries the DO metadata at boot time
<clever>
eacameron: the network stuff on lines 81-89, ive heard its buggy
<clever>
eacameron: and i believe DO lets you clone the machine after that, so you just have to configure nixops to use that as the base
<clever>
eacameron: in theory, you could use kexec to get nixos running from ram, then format the hdd and make a zfs based image
<clever>
eacameron: my kexec trick may work
<clever>
for example, making a usb stick that lacks zfs, but will mount zfs drives manualy
<clever>
eacameron: the only time you need to boot.supportedFilesystems = [ "zfs" ]; is when you want to force zfs support in and not define what to mount via zfs
<clever>
eacameron: so you need to pre-make an image with that zfs config
<clever>
eacameron: but nixops doesnt handle the partitioning/formating
<clever>
eacameron: as long as its in the fileSystems attrset, it will just work
<clever>
eacameron: yeah
<clever>
and any filesystem with requiredForBoot also gets put in boot.initrd.supportedFilesystems
<clever>
joko, eacameron: nixos will use add the .fsType of every entry in fileSystems to boot.supportedFilesystems
<clever>
20-23
<clever>
eacameron: i have an ext4 /boot partition with no crypto, and the initrd contains the zfs drivers
<clever>
eacameron: nope, that just puts a copy of memtest in /boot and adds it to grub.cfg
<clever>
joko: havent tried the new boot.initrd.ssh stuff yet
<clever>
eacameron: nixos, zfs, lvm, and luks
<clever>
eacameron: and lvm
<clever>
zero chance of data in the garbage being recovered
<clever>
gchristensen: it also gives you peace of mind when the drives get retired
<clever>
eacameron: line 20 of configuration.nix opens the luks, line 16 opens the zfs for root, and the rest is unrelated stuff
<clever>
copumpkin: i suspect that crypto only works against physical intrusions into the datacenter, assuming the attacker doesnt also steal the box of keys
<clever>
copumpkin: yeah, if they can access your aws console or the vm, they can just read the block thru the decryptor, and it does nothing
<clever>
eacameron: pretty easy, let me dig up the config for my laptop
<clever>
and there is a boot.initrd.ssh that recently got added, to let you ssh in and answer luks prompts
<clever>
eacameron: unlocking luks on bootup is a seperate issue, but it should be solveable the same as a local machine
<clever>
eacameron: the bulk of what nixops does is just nix-copy-closure, so as long as the fileSystems attrset is right and you can ssh the machine, it will keep working
<clever>
qknight_: i think nixops uses something similar, so you can refer to the ip of other boxes in the deployment
<clever>
qknight_: this is how pkgs winds up in the args for modules
<clever>
makefu: there are also switches to turn those steps off
2017-02-15
<clever>
Ralith: simplest thing i can think of is to run du on /nix/store, pick something fat that you dont like, and then nix-store --query --roots and optionaly nix-store --delete
<clever>
Ralith: part of the fun in that, is that a large object can be shared between many roots
<clever>
devoid: havent looked into how that part of nixpkgs works, so i cant do much more right now
<clever>
so you need to rename your install, give it a public domain, and make it publicly accessible
<clever>
main issue with trying to test modules like that though, is that github will often try to call back to you over http, and that always goes to the real nixos.org
<clever>
so it can be updated if its ever lost/changed
<clever>
and maybe for nixos, leave a comment with directions on where that secret has to be configured in github
<clever>
contrapumpkin: and then i just dont include passwords.nix in git
<clever>
contrapumpkin: i usualy handle secrets by doing let passwords = import ./passwords.nix ; in { .... foo = passwords.servicename; }
<clever>
should have looked for one when i tried to write that pr a few months ago
<clever>
ah nice
<clever>
iptables-restore atomicly changes the entire list in one sweep
<clever>
and also, during that time, the firewall rules are partialy built, and an attacker might be able to take advantage of it
<clever>
MoreTea: but because of this, every iptables command you run takes more and more time
<clever>
MoreTea: to avoid blocking network activity when changing rules, iptables uses an RCU list, so it copies the entire firewall list, modifies the copy, then atomicly swaps a pointer that the networking stack reads
<clever>
MoreTea: the iptables command isnt meant to be ran in a script like that, it has some large cpu usage issues
<clever>
MoreTea: one thing id like to see is for it to use iptables-restore
<clever>
MoreTea: that opens it on every interface, in this case i only wanted it on the VPN
<clever>
the nixos firewall doesnt allow you to configre things on a per-interface option, so i just manualy inserted an iptables command into the fw script
<clever>
so just doing imports = [ ./snmpd.nix ]; starts it, and allows it thru the firewall
<clever>
pareidolia: this file will now automaticaly open a hole in the firewall over the VPN
<clever>
pareidolia: then i ran into a second issue, i accidentaly used nix master, so the nix in nixos is too old to handle db.sqlite!
<clever>
pareidolia: main issue, is that gentoo files in /bin /usr and /etc usualy break nixos, so i had to rm -rf all of them
<clever>
pareidolia: and boom, now nixos is booting on the gentoo rootfs!
<clever>
pareidolia: this builds nixos on gentoo's /nix/store, then tells nixos to overwrite the MBR and re-install grub
<clever>
pareidolia: after that, it was pretty much just nix-build '<nixpkgs/nixos>' -A config.system.build.toplevel && touch /etc/NIXOS && NIXOS_INSTALL_BOOTLOADER=1 ./result/bin/switch-to-configuration boot
<clever>
which downloads it purely from the binary cache
<clever>
so i opened hydra up in lynx (not even xorg worked), grabbed the storepath for a new nix build, and used "nix-store -r /nix/store/foo-nix-1.2.3"
<clever>
i couldnt just nix-channel --update, because the nix was too old to handle the new nixpkgs
<clever>
pareidolia: what would you do?
<clever>
it was barely able to boot, but it had a year old copy of nix installed in /usr/local
<clever>
and then i had to leave in the middle of that, with half of gentoo missing
<clever>
i was in the middle of backing up the gentoo, by moving all its files from /mnt to an nfs server
<clever>
but i had an even bigger adventure after that
<clever>
nope
<clever>
i was doing it purely over the network, because gentoo was still holding on to the hdd
<clever>
ah
<clever>
so grub boots from iscsi, thinking it a local bios hdd
<clever>
ipxe hooks the legacy bios api for the hdd, and routes it over iscsi
<clever>
i had used ipxe to do the bootstrapping
<clever>
probably
<clever>
i can also boot my laptop over iscsi
<clever>
about a month ago i changed the laptop from gentoo to nixos + zfs + lvm + luks
<clever>
its just so much faster
<clever>
but i now install everyhting on it with nix-env, lol
<clever>
i still have 1 remaining gentoo install
<clever>
but now that nixo is taking over all of my systems, they all look identical!
<clever>
the older systems lacked the fancy shell colors nixos has
<clever>
prior to nixos, the biggest hint was the color of the shell
<clever>
heh, neat idea
<clever>
heh, ive shutdown -h the wrong box before because of that
<clever>
and line 184 specialy depends on all of your interfaces
<clever>
mbrgm: yeah, just a fixed delay sounds best
<clever>
so you would want to confirm you can at least reach one IP
<clever>
so even if the static ip is configured and the ethernet has a link, the switch may be blocking your traffic
<clever>
mbrgm: then the bios re-does the link, causing that 20 second timer to restart, and it would never boot
<clever>
mbrgm: i have had issues with SPAN on an old switch, the link was dead for the first 20 seconds it was online, and the network boot in my bios gave up too fast
<clever>
mbrgm: about all i can think of is to confirm you can ping some known-good ip before it starts
<clever>
mbrgm: ah
<clever>
mbrgm: i also ran into a similar issue when i was fixing my vpn a few days ago, i just made the vpn retry every 10 seconds until it came online
<clever>
mbrgm: check the output of journalctl -u dhcpcd -u keepalived and confirm if it waited for dhcpcd to fully start
<clever>
mbrgm: the systemd depencies are a bit weird, it has different modes to start a then start b, or to wait for a to fully start up, then launch b
<clever>
pareidolia: strange
<clever>
mbrgm: i dont think the journal is logging targets, so i cant see when it thinks network.target is up, but that feels like it should do what you want
<clever>
pareidolia: is try removing the wireless from configuration.nix maybe?
<clever>
k0001: and then it will kexec your choice, or the default
<clever>
k0001: i had an idea today, to make a custom bootloader, that runs as a stripped down kernel+initrd, and presents a bootloader menu over the network
<clever>
k0001: in some situations, nixops will let you re-provision the machine, and depending on the datacenter features, you may be able to recover it, but thats not 100% covered
<clever>
k0001: one problem i forsee with both nixos and nixops on remote servers, is that you sort of loose the ability to do rollbacks from grub
<clever>
tm_: a: you want nix-env -iA, b: you should never install compilers/linkers when using nix, you want nix-shell
<clever>
but about 5 minutes after that, they noticed i had pre-configured it and it was already up
<clever>
then they wanted the name/pw so they could configure the static ip, i dont think they can handle nixos ....
<clever>
so they could just replace the entire disk and its fixed
<clever>
i knew it would take too long to walk them thru fixing it, so instead, i made a .vmdk image using qemu, and sent them a URL to it
<clever>
yeah, i thought that as well
<clever>
what is my poor linux server running on....
<clever>
and c:\ was visible just off the edge of the screen
<clever>
and when i broke the VM ~2 days ago, i did get a screenshot
<clever>
i have to open a ticket up and wait for a PHOTO of the monitor
<clever>
pareidolia: the latest datacenter i have had to deal with doesnt even have the BMC plugged in, so no remote serial/console
<clever>
pareidolia: grub 2.0 does have serial support, and i have used that in the past, but this relies on the datacenter routing the serial somewhere
<clever>
this lets you kexec into a nixos install image, on any linux distro, and it runs entirely from ram
<clever>
Profpatsch: it would always load the images available on /boot, but the network just gives you control again
<clever>
in the event it gets no reply over the network, it goes to the default
<clever>
pareidolia: the basic idea, is that grub always loads a special kernel+initrd pair, that has a very thin boot menu in the initrd, that will check the network for a UDP packet, then kexec the real nixos kernel+initrd
<clever>
pareidolia: havent learned scheme yet
<clever>
pareidolia, garbas: ive also got plans for something similar/more insane, replacing grub with either haskell or rust, and allowing control over the network
<clever>
lassulus: oops, wrong L name
<clever>
LnL: both of those run with the entire rootfs in ram