Skip to content

Instantly share code, notes, and snippets.

View project0's full-sized avatar
:octocat:

Richard Hillmann project0

:octocat:
View GitHub Profile
@project0
project0 / reaction.html
Last active February 2, 2020 18:33
Get random picture from tumblr blog like devopsreactions.tumblr.com
<html>
<head>
<title>DevOps Reaction</title>
<style type="text/css">
body { background-color:#000; color:#fff }
h1 { font-size:35pt }
</style>
<script src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
<script>
# /etc/systemd/system/loop@.service
# systemctl daemon-reload
# systemctl start loop@sdxx
# systemctl enable loop@sdxx
[Unit]
Description=Mount journal partition as loop2
Before=ceph-osd.target
[Service]
Type=oneshot
ExecStart=/sbin/losetup /dev/loop2 /dev/%i
@project0
project0 / update_puppet_ca.sh
Last active July 15, 2022 01:42
How to replace/update the puppet ca on expire
#!/bin/bash
#### START CUSTOM CONFIG
##
# root path of all certs stuff. May be differ from default
ssl_path=/etc/puppet/ssl
# how many days should the certs are valid
ssl_days=3650
@project0
project0 / catalog.pp
Last active February 15, 2018 21:33
draft puppet bareos define catalog.pp
define bareos::director::catalog (
$ensure = present,
$db_address = undef,
$db_driver = undef,
$db_name = undef,
$db_password = undef,
$db_port = undef,
$db_socket = undef,
$db_user = undef,
$description = undef,
@project0
project0 / ad_password_reset.go
Last active May 6, 2024 09:47
Go AD password reset
package passwordresetservice
import (
"crypto/tls"
"fmt"
ldap "github.com/go-ldap/ldap"
"golang.org/x/text/encoding/unicode"
ber "gopkg.in/asn1-ber.v1"
)
@project0
project0 / req.conf
Created February 2, 2020 18:03
openssl create certificate req
[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
prompt = no
[req_distinguished_name]
C = DE
ST = BY
L = Munich
O = Corp
OU = IT
AWS_INSTANCE_ID=$(curl http://169.254.169.254/latest/meta-data/instance-id)
ROOT_VOLUME_IDS=$(aws ec2 describe-instances --region ${AWS::Region} --instance-id $AWS_INSTANCE_ID --output text --query Reservations[0].Instances[0].BlockDeviceMappings[0].Ebs.VolumeId)
TAG_LIST=$(aws ec2 describe-instances --region ${AWS::Region} --instance-id $AWS_INSTANCE_ID --output text --query "Reservations[0].Instances[0].Tags" | grep -v "aws:" | awk '{split($0,a,"\t"); printf "Key=\"%s\",Value=\"%s\" ", a[1], a[2]}')
aws ec2 create-tags --resources $ROOT_VOLUME_IDS --region ${AWS::Region} --tags $TAG_LIST
@project0
project0 / cf-s2s-vpn.yaml
Created August 10, 2020 07:49
Cloudformation template to create a site to site ipsec VPN
AWSTemplateFormatVersion: '2010-09-09'
Description: Site to Site VPN
Parameters:
RemoteIP:
Description: Remote IP for the ipsec connection
Type: String
RemoteCIDR:
Description: The destination network CIDR
Type: String
@project0
project0 / kms.sh
Created November 2, 2020 17:34
AWS KMS encryption/decryption
#!/bin/bash
function awskmsencrypt() {
key="$1"
text="$2"
aws kms encrypt --key-id "$key" --plaintext fileb://<(echo "$text") --output text --query CiphertextBlob
}
function awskmsdecrypt() {
crypt="$1" #base64