Skip to content

Instantly share code, notes, and snippets.

View Nepherte's full-sized avatar

Bart Verhoeven Nepherte

View GitHub Profile
@Nepherte
Nepherte / synology-import-ssl.sh
Last active May 30, 2024 17:17
Script to import an SSL certificate into a Synology NAS.
#!/usr/bin/env bash
# The id of the certificate to install.
CERT_ID="$1"
# The packages whose certificate to replace.
CERT_PKGS="${@:2}"
# The directory that holds to certificate to import.
CERT_IMPORT_DIR="/tmp/certificate/$CERT_ID"
@Nepherte
Nepherte / auth.nepherte.com.sh
Last active January 13, 2022 04:59
Let's Encrypt hook to deploy an SSL certificate onto a Synology NAS for Radius and LDAP.
#!/usr/bin/env bash
set -e
function deploy_to_synology {
# The id of the certificate on the Synology NAS.
local CERT_ID="7RY4jQ"
# The packages on the Synology NAS that use the certificate.
local CERT_PKGS="radiusd slapd"
@Nepherte
Nepherte / osiris.nepherte.com.sh
Last active January 13, 2022 05:00
Let's Encrypt hook to deploy an SSL certificate onto a Synology NAS for nginx.
#!/usr/bin/env bash
set -e
function deploy_to_synology {
# The id of the certificate on the Synology NAS.
local CERT_ID="crFPXQ"
# The packages on the Synology NAS that use the certificate.
local CERT_PKGS="system 4b4b117d-07d1-49db-9b42-7e1281cf3326"
@Nepherte
Nepherte / ui-import-ssl.sh
Last active April 3, 2024 02:32
Script to import an SSL certificate into a UniFi Controller.
#!/usr/bin/env bash
# unifi_ssl_import.sh
# UniFi Controller SSL Certificate Import Script for Unix/Linux Systems
# by Steve Jenkins <http://www.stevejenkins.com/>
# Part of https://github.com/stevejenkins/ubnt-linux-utils/
# Incorporates ideas from https://source.sosdg.org/brielle/lets-encrypt-scripts
# Version 2.8
# Last Updated Jan 13, 2017
@Nepherte
Nepherte / ui.nepherte.com.sh
Last active April 3, 2024 02:30
Let's Encrypt hook to deploy an SSL certificate to a UniFi Controller.
#!/bin/sh
set -e
for domain in $RENEWED_DOMAINS; do
case $domain in
ui.nepherte.com)
/usr/local/bin/ui-import-ssl.sh
;;
esac
@Nepherte
Nepherte / usg-import-ssl.sh
Created October 11, 2020 14:21
Script to import an SSL certificate into a UniFi USG.
#!/usr/bin/env bash
# Graceful shutdown of the http server.
kill -SIGINT $(cat /var/run/lighttpd.pid)
# Install certificate in the http server.
mv /home/admin/.certificate/server.pem /etc/lighttpd/server.pem
chown root:root /etc/lighttpd/server.pem; chmod 0400 /etc/lighttpd/server.pem
# Start http server with new certificate.
@Nepherte
Nepherte / gateway.nepherte.com.sh
Last active January 24, 2023 08:01
Let's Encrypt hook to deploy an SSL certificate to a UniFi USG.
#!/usr/bin/env bash
set -e
# Deploys the certicate.
function deploy_to_usg {
# The key to use to login to the UniFi USG.
local SSH_KEY="/root/.ssh/unifi-usg"
# The user and hostname of the UniFi USG.
local HOST="[email protected]"
@Nepherte
Nepherte / 50-sysinfo
Last active April 20, 2023 12:54
Message of the day: system info
#!/bin/bash
echo ""
echo " .~~. .~~. "
echo " '. \ ' ' / .' "
echo ""
echo " .~ .~~~..~. "
echo " : .~.'~'.~. : "
echo " ~ ( ) ( ) ~ "
echo " ( : '~'.~.'~' : )"
@Nepherte
Nepherte / digital-ocean-dynamic-dns
Last active February 25, 2023 13:45
Daily cron script to update external ip address of home network.
#!/bin/sh
# Binary can be obtained from: https://github.com/anaganisk/digitalocean-dynamic-dns-ip
digitalocean-dynamic-dns /home/bart/.config/digital-ocean/dynamic-ip.json
@Nepherte
Nepherte / mullvad-dns-desktop.mobileconfig
Last active December 6, 2023 06:34
Apple macOS Profile for Mullvad Encryted DNS (HTTPS)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<!-- Use Mullvad Encrypted DNS (HTTPS) -->
<key>DNSSettings</key>