Skip to content

Instantly share code, notes, and snippets.

View erikankrom's full-sized avatar

Erik Ankrom erikankrom

  • Amazon Web Services
  • Olathe, KS
  • 22:08 (UTC -05:00)
View GitHub Profile
@erikankrom
erikankrom / README.md
Last active June 1, 2020 13:09 — forked from 0x1b-xyz/eap_proxy-udmpro-health.sh
A script that manages the lifecycle of the eap_proxy-udmpro container on a UDM PRO between reboots or firmware updates. See https://github.com/pbrah/eap_proxy-udmpro for the upstream image.

This script is meant to be run from a secure host where you don't mind having your UDM root ssh password stored as cleartext. The script will build an image (lazily) on this secure host that contains an expect script that logs in to your UDM Pro and start (as needed) the pbrah/eap_proxy-udmpro:v1.1 image.

Env Default Desc
TARGET_HOST unifi UDM Pro IP or hostname
PASSWORD_FILE Required Clear text UDM Pro root password file
LOCAL_IMAGE_NAME eap_proxy-healthcheck Name of the image that is built on your secure host and executes the container with expect script against the UDM
UDM_CONTAINER_NAME eap_proxy-udmpro Name of the eap_proxy container that should be running on the UDM
EAP_PROXY_IMAGE pbrah/eap_proxy-udmpro:v1.1 Desired eap_proxy-udmpro Image
#!/bin/bash
NAME="unifi.example.com"
/usr/bin/letsencrypt renew
if test $(find /etc/letsencrypt/live/$NAME/cert.pem -mmin -60)
then
/bin/systemctl stop unifi.service
/usr/bin/openssl pkcs12 -export -inkey /etc/letsencrypt/live/$NAME/privkey.pem -in /etc/letsencrypt/live/$NAME/fullchain.pem -out /tmp/$NAME.p12 -name ubnt -password pass:temppass
/bin/keytool -importkeystore -deststorepass aircontrolenterprise -destkeypass aircontrolenterprise -destkeystore /opt/UniFi/data/keystore -srckeystore /tmp/$NAME.p12 -srcstoretype PKCS12 -srcstorepass temppass -alias ubnt -noprompt

Keybase proof

I hereby claim:

  • I am erikankrom on github.
  • I am erikankrom (https://keybase.io/erikankrom) on keybase.
  • I have a public key whose fingerprint is 12FC 1063 02CF BBD7 0007 5C3A 4A2A E5DF 043C 3F29

To claim this, I am signing this object:

@erikankrom
erikankrom / accounts-models.py
Created September 5, 2011 22:36
Multiple Profiles for Internal/External Users
from django.db import models
from django.contrib.auth import User
from mycompany.models import Client
from userprofiles.models import Profile
class External(Profile):
#External-specific models
client = models.ForeignKey(Client)
def __unicode__(self):