Skip to content

Instantly share code, notes, and snippets.

@OnkelDom
OnkelDom / WSL2.md
Last active June 8, 2023 08:54
My WSL2 Setup with PowerShell7, Ubuntu, Windows Terminal, Powerline, SourceCodePro, Azure Tools

Install WSL2 and Ubuntu

First run: WSL2 Setup

Windows Tutorial: Install WSL2 (if needed)

Install PowerShell 7

# You need administrator grants on normal PowerShell terminal
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"

Add IPv6 for you DHCP from KVM

sudo dnf install fence-agents-virsh

sudo virsh net-destroy default
sudo virsh net-edit default

<network>
 # other configuration here

USG Cloudflare DynDNS Update

Dokumentation to setup ddns updates for your home domain hostet by cloudflare.

In the first step, add the a record for your hostname manualy.

I addet a cname *.hostname.domain.tld for the other home domains. So you can use letsencrypt at home for any subdomain.

USG Configuration, update ddclient

Create /data LVM

sudo dd if=/dev/zero of=/dev/sdb
sudo dd if=/dev/zero of=/dev/sdc
sudo dd if=/dev/zero of=/dev/sdd
sudo dd if=/dev/zero of=/dev/sde
sudo pvcreate /dev/sdb /dev/sdc /dev/sdd /dev/sde
sudo vgcreate content /dev/sdb /dev/sdc /dev/sdd /dev/sde
sudo lvcreate --mirrors 1 --type raid1 -l 100%FREE -n hdd content /dev/sdd /dev/sde

Create your own certificate authority

CA Key erstellen:

openssl genrsa -aes256 -out ca-key.pem 4096

CA erstellen:

openssl req -x509 -new -nodes -extensions v3_ca -key ca-key.pem -days 3650 -out ca-root.pem -sha512 -subj '/C=DE/ST=Hessen/L=Heusenstamm/O=OnkelDom/OU=Ops/CN=onkeldom.lan/emailAddress=certs@onkeldom.eu'
@OnkelDom
OnkelDom / cloudflare-ddns.sh
Last active July 30, 2021 21:53
Update A und AAAA record for dnsrecord
#!/bin/bash
# A bash script to update a Cloudflare DNS A and AAAA record with the external IP of the source machine
# Used to provide DDNS service for my home
# Needs the DNS record pre-creating on Cloudflare
# I run this directly on my router (usg) as cronjob every 15 minutes
# put this script in root or another folder
# put the following line in you cron.d folder
# "*/15 * * * * root /root/cloudflare-ddns.sh 2>&1 | logger -t cloudflare"
# Proxy - uncomment and provide details if using a proxy
# update the package manager and install some prerequisites (all of these aren't technically required)
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common libssl-dev libffi-dev git wget nano
# create a group named docker and add yourself to it
# so that we don't have to type sudo docker every time
# note you will need to logout and login before this takes affect (which we do later)
sudo groupadd docker
sudo usermod -aG docker ${USER}
// Exmaple Pac-File
function FindProxyForURL(url, host)
{
//set variables
var client = myIpAddress();
var direct = "DIRECT";
var proxy = "PROXY proxy.home.onkeldom.eu:3128";
var proxy-internal = "PROXY proxy.home.onkeldom.eu:3130";
// proxy while Split-Brain - special way for onkeldom.eu
$ sudo vim /etc/rsyslog.conf
# /etc/rsyslog.conf configuration file for rsyslog
#
# For more information install rsyslog-doc and see
# /usr/share/doc/rsyslog-doc/html/configuration/index.html
#################
#### MODULES ####
#################
update webproxy blacklists
configure
set service webproxy cache-size 0
set service webproxy default-port 3128
set service webproxy listen-address 192.168.1.1
set service webproxy enable-access-log
set service webproxy administrator proxy@onkeldom.eu
set service webproxy mem-cache-size 5
set service webproxy url-filtering squidguard auto-update update-hour 5
set service webproxy url-filtering squidguard block-category adult