Skip to content

Instantly share code, notes, and snippets.

@spoelstraethan
spoelstraethan / yubikey-crosh-secure-shell.md
Last active February 10, 2025 22:13 — forked from espoelstra/yubikey-crosh-secure-shell.md
Access ChromeOS chronos user shell via ssh (requires root/sudo for initial setup and once per boot for non-local iptables rule and starting /usr/bin/sshd) with SSH key passwordless auth

Why oh why

I want to develop some scripts for things like Chrx, Chromebrew, MrChromebox scripts etc and I don't want to register a new SSH key to my account every time I need to powerwash or use recovery on one of my Chromebooks because I messed it up. I already use my Yubikey for GPG/FIDO/U2F/SSH on all the other systems I develop on, and I only needed the SSH portion to work for this particular use case. I also didn't want to deal with using Crouton or Crostini since that requires additional downloads and more configuration and complexity.

Challenges

Since the Crosh userland doesn't have scdaemon or pcscd for talking to the smart card, I had to come up with another way to access the Yubikey and make the SSH key available. I ended up trying a few different things to make it work, but overall the solution ended up being brilliantly straightforward. Originally I tried using Chromebrew to install one of the smartcard access/manager packages, but the dependency chain ended up pulling in Gnome keyring and a

@spoelstraethan
spoelstraethan / !notes.md
Created October 26, 2023 18:22
WSL WSL2 subnet size/address adjustments

In an elevated Powershell

Get-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Lxss" -Name "NatNetwork"

This prints the current network in CIDR, the /20 is WAY too many hosts for what almost anybody might need.

Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Lxss" -Name "NatNetwork" -Value "172.17.128.0/24"

@spoelstraethan
spoelstraethan / gist:32f56345de28a7b47d9bf44f3a0bbc65
Last active September 3, 2022 20:00
(WARNING: Work In Progress, ChromeOS breaks due to how holoinstall messes with the grub) Modified holoinstall to install on a Chromebook after running Chrx to set up dual boot
#!/bin/zsh
# HoloISO Installer v2
# This defines all of the current variables.
CMD_PACMAN_INSTALL=(/usr/bin/pacman --noconfirm -S --needed --disable-download-timeout --overwrite="*")
CMD_PACMAN_UPDATE=(/usr/bin/pacman -Sy)
CPU_VENDOR=$(cat /proc/cpuinfo | grep 'vendor' | uniq | cut -c 13-)
SYSTEM_LOCALE="${SYSTEM_LOCALE:-en_US.UTF-8 UTF-8}"
HOLO_INSTALL_DIR="${HOLO_INSTALL_DIR:-/mnt}"
# Internet connectivity check
@spoelstraethan
spoelstraethan / !notes.md
Created September 1, 2022 04:08
Steps to get LG R100 working on Linux (Arch/SteamOS/etc)
@spoelstraethan
spoelstraethan / gist:53c1b7b188845ac9f0957d70be5cfab5
Last active November 15, 2021 19:19
ChromeOS Brunch easy CLI extract and updates
# Download your recovery from https://cros-updates-serving.appspot.com
# Ctrl+Shift+T or open a Crosh Window and type `shell`
# Without arguments `cd` takes you to your $HOME directory
cd
#
cd Downloads/
ls
# Create a temporary directory and capture the name to a variable so we can reuse
MOUNTZIP=$(mktemp -d -p /tmp -t XXXXXX)
fuse-zip chromeos_*.bin.zip $MOUNTZIP
@spoelstraethan
spoelstraethan / !notes.md
Last active September 26, 2021 00:59
Cosmo Communicator handy snippets for i3 or scripting

i3 fixes

sudo apt install i3 rofi
sed -i -e 's/47/48/' -e 's/pango://' /etc/i3/config.keycodes /etc/i3/config
# even with the pango: removed from the config the wizard uses it and fails to show up properly on first login
i3-config-wizard -m alt

Battery device for i3status

@spoelstraethan
spoelstraethan / gist:f0c0f2543e413c01ff3dac9272aef194
Created August 30, 2020 20:25
ssvnc + ss to find open VNC port from Packer/Vagrant
ssvnc -viewer $(ss -ltH '( dport geq :5900 and dport leq :5999 or sport geq :5900 and sport leq :5999 )' | tr -s [:blank:] |cut -d' ' -f 4)

I was having some trouble with libvirt on a Chromebook that supports /dev/kvm passthrough after installing virt-manager and the other packages and what finally fixed it was using sudo apt update && sudo apt upgrade -y and upgrading to Debian Buster 10.3 (I was on 10.2) and then sudo gpasswd -a $USER libvirt and sudo gpasswd -a $USER kvm and then quitting my shell and logging out and then when I logged back in I ensured that I was in the right groups by running id. It turns out that for some reason the kvm group doesn't stick, but running sudo gpasswd -a $USER kvm; newgrp kvm gives you a shell where you can run qemu-system-x86_64 and then I didn't have any further warnings or permissions issues from virt-host-validate. sudo apt install cpu-checker also let me run sudo kvm-ok to validate that the system was KVM ready.