Skip to content

Instantly share code, notes, and snippets.

@marksteele
Created March 19, 2015 19:52
Show Gist options
  • Save marksteele/c65fe9797e2a42dcb1a0 to your computer and use it in GitHub Desktop.
Save marksteele/c65fe9797e2a42dcb1a0 to your computer and use it in GitHub Desktop.
tinc startup script mac osx
laptop1333:~ root# cat start_tinc.sh
#!/bin/bash
TITLE="TINC PASS PROMPT";
TEXT="Tinc private key password:";
IFS=$(printf "\n");
CODE=("on GetCurrentApp()");
CODE=(${CODE[*]} "tell application \"System Events\" to get short name of first process whose frontmost is true");
CODE=(${CODE[*]} "end GetCurrentApp");
CODE=(${CODE[*]} "tell application GetCurrentApp()");
CODE=(${CODE[*]} "activate");
CODE=(${CODE[*]} "display dialog \"${@:-$TEXT}\" default answer \"\" with title \"${TITLE}\" with icon caution with hidden answer");
CODE=(${CODE[*]} "text returned of result");
CODE=(${CODE[*]} "end tell");
SCRIPT="/usr/bin/osascript"
for LINE in ${CODE[*]}; do
SCRIPT="${SCRIPT} -e $(printf "%q" "${LINE}")";
done;
PASSPHRASE=`eval "${SCRIPT}"`;
echo $PASSPHRASE | openssl rsa -passin stdin -text -in /usr/local/etc/tinc/darknet/rsa_key_enc.priv | /usr/local/sbin/tincd -n darknet -D &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment