Skip to content

Instantly share code, notes, and snippets.

@ammgws
ammgws / archlinux_chroot_jail_user_setup_guide.md
Created March 15, 2021 13:40
Create chroot jail so friend can SSH into server and/or use it for sshuttle (Arch Linux)

Replace "jaileduser" with whatever you want the username to be.

Step 1 (as root) - Setup chroot environment and user. Replace fish in the last command with whatever shell you want.

sudo su - 
mkdir --parents /home/jaileduser/home
useradd --create-home --gid users --home /home/jaileduser/home/jaileduser jaileduser
usermod --home /home/jaileduser jaileduser
mkdir --parents /{etc/jail/jaileduser,var/jail/jaileduser/{cache/{key,pkg},lib}}
chown jaileduser:users /var/jail/jaileduser/cache/key
@ammgws
ammgws / setup_fulldisk_encryption_rpi.md
Last active December 9, 2023 08:46
Notes on how to setup full disk encryption on an already setup Raspbian system

Setup full disk encryption using LVM on LUKS (single drive) with remote SSH for an already setup/running Raspbian stretch system. Using this guide there is no need to connect a screen or keyboard to the rpi at any stage since we will setup remote SSH at the same time (at present no other guides available tell you that this is possible).

1. Backup SD card

To be safe, backup SD card (using another computer is easiest in my case): sudo dd bs=4M if=/dev/<rpi_sdcard> | gzip > rpibackup.img.gz or use my fish shell function.

2. Install LUKS dependencies and reboot

@ammgws
ammgws / proxmox_CT_distupgrade_fix.md
Last active November 16, 2023 14:54
Fix for Proxmox container failing to start after dist-upgrade
  • Upgraded from Ubuntu 16.04 LTS to 18.04 (pre-release) using dist-upgade
  • Upon restart CT would not start
  • Error displayed in Web GUI: command 'systemctl start pve-container@101' failed: exit code 1
  • SSHd in and manually ran CT with pct start 101:
>root@server:~# pct start 101
Job for pve-container@101.service failed because the control process exited with error code.
See "systemctl status pve-container@101.service" and "journalctl -xe" for details.
command 'systemctl start pve-container@101' failed: exit code 1
@ammgws
ammgws / missing_ufw_samba.md
Last active September 24, 2023 00:53
Missing ufw samba application profile in /etc/ufw/applications.d

Am using a samba share on Ubuntu 16.04 server, and wanted to enable Samba traffic in ufw using sudo ufw allow from 192.168.8.0/24 to any app Samba comment 'allow samba from local' which returned the error "ERROR: Could not find a profile matching 'Samba'".

Cause: I was using the minimal amount of tooling required to use Samba (cifs-tools) on my server, which doesn't include the Samba application file.

Fix: install the samba package... or manually create the file:

sudoedit /etc/ufw/applications.d/samba

[Samba]
title=LanManager-like file and printer server for Unix
@ammgws
ammgws / create-iso.sh
Created August 29, 2023 13:42 — forked from julianxhokaxhiu/create-iso.sh
Simple bash script to create a Bootable ISO from macOS Catalina Install Image from Mac App Store
#!/usr/bin/env bash
#===========================================================================
# Works only with the official image available in the Mac App Store.
# Make sure you download the official installer before running this script.
#===========================================================================
hdiutil create -o /tmp/Catalina.cdr -size 9000m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Catalina.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo /Applications/Install\ macOS\ Catalina.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build --nointeraction
hdiutil detach "/Volumes/Install macOS Catalina"
@ammgws
ammgws / reddit_video_fallbackURL_bookmarklet.js
Created August 2, 2023 07:47
Bookmarklet to get Reddit Video fallback URL (tested in Firefox)
javascript:(function() {
var currentUrl = window.location.href;
if (!currentUrl.includes("reddit")) {
alert("This bookmarklet is designed for Reddit pages only.");
return;
}
var jsonUrl = currentUrl + ".json";
fetch(jsonUrl)
.then(response => response.json())
.then(data => {
@ammgws
ammgws / letsencrypt-acme-guide.md
Last active July 23, 2023 17:19
Using acme.sh script to renew LetsEncrypt certs using non-standard SSL port

1. Install acme.sh shell script

git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
./acme.sh --install

Optionally, set the home dir and/or account info (if already have one).
If was previously using LetsEncrypt's certbot, can probably get account info from /etc/letsencrypt/accounts/acme-v01.api.letsencrypt.org/directory/*/regr.json.

@ammgws
ammgws / edgerouter_lite_openvpn.md
Last active April 16, 2023 05:04
Notes on setting up OpenVPN on Edgerouter Lite

My notes on how I setup OpenVPN server on Edgerouter Lite. Based mostly on this guide from openVPN wiki. This guide assumes easyrsa3 is being used, otherwise substitute whatever the easyrsa2 versions are for the commands below.

This guide will use 3 different machines.

A Public Key Infrastructure (PKI) will be created on each machine:

    1. Server - openVPN server (Edgerouter in this case).
    1. Client(s) - the device(s) you will be connecting from.
    1. CA Server - used to generate and sign certificates for server and clients to use.
@ammgws
ammgws / alx_wol.md
Created July 23, 2017 16:32
re-enable WOL for atheros (alx) driver

Use the script from here.

automatic dkms module installer for patched alx

This is a quick and dirty setup that will automatically setup the dkms module for your specific kernel version.
This will only work on debian/ubuntu and other derivates and requires dkms and patch to be setup already.

The setup uses sudo and thus you are asked for your password once.
It will then attempt to download your kernels source, copy and patch the alx related files and place a "alx-" in your /usr/src directory, enable and compile the module and finally rebuild your initrd.
Currently the the very first compilation somehow fails, thats why it's run twice.

[
{
"identifier": "2:7:SynPS\/2_Synaptics_TouchPad",
"name": "SynPS\/2 Synaptics TouchPad",
"vendor": 2,
"product": 7,
"type": "touchpad",
"scroll_factor": 1.0,
"libinput": {
"send_events": "enabled",