Skip to content

Instantly share code, notes, and snippets.

View richeney's full-sized avatar

Richard Cheney richeney

View GitHub Profile
@richeney
richeney / DoH.md
Last active January 22, 2024 05:28
Cloudflare DNS over HTTPS

DNS over HTTPS

Settings | Network & Internet | Ethernet/WiFi | DNS server assignment | Edit

Add automatic templates:

netsh dns add encryption server=1.1.1.3 dohtemplate=https://cloudflare-dns.com/dns-query
netsh dns add encryption server=1.0.0.3 dohtemplate=https://cloudflare-dns.com/dns-query
netsh dns add encryption server=2606:4700:4700::1113 dohtemplate=https://cloudflare-dns.com/dns-query
@richeney
richeney / git_init_in_wsl.md
Last active April 21, 2023 09:53
Initialise Git repo from WSL2

Initialise git repo, push into GitHub

Needs git and gh.

Quick bashrc function

Add to .bashrc

github() {
@richeney
richeney / codetunnel.md
Last active January 22, 2024 05:27
Code Tunnel

Code Tunnels

https://www.azurecitadel.com/arc/servers/access_vms/#code-tunnels

Install & configure on VM

wget https://code.visualstudio.com/sha/download?build=stable\&os=cli-alpine-x64 -O /tmp/code.tar.gz
sudo tar -zxvf /tmp/code.tar.gz -C /usr/local/bin && rm /tmp/code.tar.gz
code tunnel --name $(hostname) --accept-server-license-terms
@richeney
richeney / terraform_cloud.md
Last active January 22, 2024 05:28
Terraform Cloud

Using Terraform Cloud with Vault and OIDC

Requires jo

sudo apt update && sudo apt install jo -y

Create an example repo

@richeney
richeney / immutable-pls.md
Last active January 22, 2024 05:28
Immutable Storage Accounts and Private Link Service

Immutable Storage Accounts, Private Link and Private Link Service

Introduction

This is a POC for immutability in a legal hold situation. The assumption is that an Azure Storage Account will be used as a target for images, documents etc. that need to be provably unchanged for a required legal period.

Immutability policy scope

Immutability policies can be scoped to a blob version or to a container. How an object behaves under an immutability policy depends on the scope of the policy.

@richeney
richeney / import_keyvault_certificates.sh
Created January 19, 2022 12:09
Bash crontab script to import PEM certs downloaded by the Azure Keyvault extension
#!/usr/bin/env bash
################################################################
# Search for certs downloaded by the Azure Key Vault Extension,
# convert from PEM to DER format and update the CA certificates.
#
# Designed to be run as root from crontab.
# Will be silent if no files are converted.
################################################################
error()
@richeney
richeney / azcmagent_token
Last active March 22, 2021 19:39
Creates and displays a token if a resource is specified. Defaults to https://management.azure.com. Designed for Azure Arc VMs.
#/bin/bash
error()
{
[[ -n "$@" ]] && echo "ERROR: $@" >&2
exit 1
}
urlencode() {
# urlencode <string>
@richeney
richeney / addpolicy.sh
Created January 25, 2021 14:11
Takes a full Azure Policy JSON file and creates a policy definition. Requires jq and zip.
#!/bin/bash
###################################################################################################
## Loop through stdin of ARM resource compliant policy files
## Example format is
## https://github.com/richeney/azure-blueprints/blob/master/policies/auditemptytag.json
## Requires az and jq
## Can use unpathed URIs if you have exported URIBASE
###################################################################################################
error()
@richeney
richeney / cloudshell.vim
Created December 3, 2020 18:19
Custom VIM colours
" Vim color file
" Maintainer: Richard Cheney (from delek.vim)
" Last Change: 2018 Apr 09
hi clear
let g:colors_name = "cloudshell"
" Normal should come first
hi Normal guifg=Black guibg=White