Skip to content

Instantly share code, notes, and snippets.

zoredache /
Created May 12, 2023 19:15
Forward a Windows agent from Windows into WSL2.

Since people still seem to be having problems with this, I thought I would post my solution for getting a pretty reliable agent into WSL2.

I have found the npipe+socat options pretty unstable, and frustrating.

My solution for getting an agent into WSL uses a combination of WSL2 systemd support, OpenSSH server installed in WSL2, and using OpenSSH client in Windows.

Prepare the environment

  • Install the openssh client on windows, run some kind of agent on Windows and add your keys. Make sure you can see your keys on the Windows side by running ssh-add.exe -L
  • Setup your favorite WSL distro configure for WSL2.
zoredache / sign_ssh_host_keys.yml
Last active October 5, 2021 08:22
View sign_ssh_host_keys.yml
# signing key generated with
# ssh-keygen -t ed25519 -f 20200624_ca_ed25519 -C 20200624_ca_ed25519 -N ""
# encrypted with ansible-vault
# ansible-vault encrypt 20200624_ca_ed25519
- hosts: localhost:linux_systems
zoredache /
Last active August 27, 2021 18:52
Install ansible centos
# all the ansible python packages will be nicely self contained in this directory.
mkdir -p /etc/ansible
mkdir -p ${virtualenv_path}
# Create requirements file for pip
# and more, or remove as needed.
echo "
zoredache / switch_backup.yml
Created April 30, 2020 17:20
ansible switch_backup.yml
View switch_backup.yml
- hosts: switches
gather_facts: no
track_changes: yes
data_dir: "data/switches"
- name: create data directory if needed
zoredache /
Last active December 20, 2022 21:15 Debian/Ubuntu
set -euo pipefail
set -x
# Install packages needed on a base Debian system
apt-get update
</dev/null DEBIAN_FRONTEND=noninteractive \
apt-get --yes install --no-install-recommends $(
zoredache /
Created March 13, 2018 18:59
ansible gpg vault script
# adapted from
# ansible.cfg
# [defaults]
# # decryption passphrase and key in lastpass
# vault_password_file = ./
if [ -z "$GPG_TTY" ]; then
zoredache / minecraft@.service
Created August 23, 2017 22:39
systemd minecraft unit - /etc/systemd/system/minecraft@.service
View minecraft@.service
# adapted from
Description=Minecraft Server %i
Environment="JAVABIN=/usr/bin/java" "JAVAOPTS=-Xmx1024M -Dlog4j.configurationFile=log4j2.xml" "MCJAR=paperclip.jar" "MCOPTS=--
zoredache / Demonstrate-CredentialFile.ps1
Created March 3, 2016 22:56
Demonstration of accepting credentials from a variable or file
View Demonstrate-CredentialFile.ps1
Demonstration of accepting credentials in a variable or file
This is only an demonstration of how a script can accept either a file
with stored credentials, or a PSCredential object, so that it can be used
performing tasks that require authentication.
.PARAMETER CredentialFile