Skip to content

Instantly share code, notes, and snippets.

@tatsuryu
tatsuryu / renew-gpgkey.md
Created July 15, 2022 17:21 — forked from krisleech/renew-gpgkey.md
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@tatsuryu
tatsuryu / run.tpl
Created November 17, 2020 21:32 — forked from efrecon/run.tpl
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name {{printf "%q" .Name}} \
{{- with .HostConfig}}
{{- if .Privileged}}
--privileged \
{{- end}}
{{- if .AutoRemove}}
--rm \
{{- end}}
{{- if .Runtime}}
@tatsuryu
tatsuryu / registry.yaml
Created November 11, 2020 22:35 — forked from r0xen/registry.yaml
Private Docker Registry Behind Traefik 2.2 Configuration for Docker Swarm
version: "3.7"
services:
registry:
image: registry:2.7.1
networks:
- swarm_net
environment:
- REGISTRY_HTTP_ADDR=0.0.0.0:5000
- REGISTRY_HTTP_RELATIVEURLS=true
- REGISTRY_LOG_ACCESSLOG_DISABLED=false
@tatsuryu
tatsuryu / traefik_portainer.md
Created November 11, 2020 22:34 — forked from ruanbekker/traefik_portainer.md
Traefik with SSL + Portainer on Docker Swarm Repro

Traefik and Portainer on Docker Swarm with Letsencrypt

Reproducing a Traefik with SSL and Portainer setup on a 2 Node Docker Swarm

Install Docker:

Install Docker on both nodes with a Bootstrap Script:

$ curl https://gitlab.com/rbekker87/scripts/raw/master/setup-docker-ubuntu.sh | bash
(venv) user@dumb:/tmp/test$ for f in *yml;do echo "# $f #####";cat $f;ansible-playbook -D $f;done
# test_nouser.yml #####
- hosts: localhost
become: true
tasks:
- docker_swarm_service:
name: traefik-lb
state: absent
- docker_network:
name: traefik-net
@tatsuryu
tatsuryu / git-obliterate
Created September 21, 2020 17:40 — forked from brianloveswords/git-obliterate
git-obliterate: for removing sensitive files you may have committed from the entire history of the project.
#!/bin/bash
file=$1
test -z $file && echo "file required." 1>&2 && exit 1
git filter-branch -f --index-filter "git rm -r --cached $file --ignore-unmatch" --prune-empty --tag-name-filter cat -- --all
git ignore $file
git add .gitignore
git commit -m "Add $file to .gitignore"
@tatsuryu
tatsuryu / self-signed-certificate-with-custom-ca.md
Created September 19, 2020 20:49 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@tatsuryu
tatsuryu / server.py
Created July 8, 2020 20:29 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):
@tatsuryu
tatsuryu / README.md
Created July 2, 2018 19:27
Open VPN client connect/disconnect emailer script

This script is intended to be used with Open VPN as the client-connect and client-disconnect scripts, to send an email using Mailgun to a certain address when a client connects or disconnects.

To install this, copy the below file to /etc/openvpn/statuschange.sh, replace the to email with your own, the and the from email, the URL, and the API key with your own Mailgun login. (I use the sandbox because I didn't feel like messing with DNS.)

Then, add the following to /etc/openvpn/server.conf:

client-connect /etc/openvpn/statuschange.sh
client-disconnect /etc/openvpn/statuschange.sh
script-security 2