Skip to content

Instantly share code, notes, and snippets.

#!/bin/zsh
if [ $(id -u) -ne 0 ]; then
echo 1>&2 'You must run strongswan-config.sh as root.'
exit 1
fi
# Only configure when charon is starting by checking for presence of the pid file
if [ -f /var/run/charon.pid ]; then
sleep 10
l="/var/log/strongswan-config.log"
c=8
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.strongswan.config</string>
<key>ServiceDescription</key>
<string>Configure the StrongSwan charon service after it starts</string>
<key>ProgramArguments</key>
<array>
@sddj
sddj / com.strongswan.start.plist
Last active February 28, 2021 17:19
macOS StrongSwan launchd config
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.strongswan.start</string>
<key>ServiceDescription</key>
<string>Start the StrongSwan charon service</string>
<key>ProgramArguments</key>
<array>
@sddj
sddj / strongswan-start.sh
Last active February 28, 2021 17:18
macOS StrongSwan startup script
#!/bin/zsh
if [ $(id -u) -ne 0 ]; then
echo 1>&2 'You must run strongswan-start.sh as root.'
exit 1
fi
l="/var/log/strongswan.log"
c=8
while [ "${i}" -ge 0 ]; do
if [ -f "${l}.${i}" ]; then
mv "${l}.${i}" "${l}.$((i+1))"
@sddj
sddj / setup-cert.sh
Created June 20, 2020 15:50
Generate certificate from private CA
#!/bin/bash
#
# ./setup.sh es1
#
cat >$1.cnf <<EOF
[ req ]
default_bits = 2048
default_keyfile = $1.key
encrypt_key = no
default_md = sha256
@sddj
sddj / setup-ca.sh
Created June 20, 2020 15:48
OpenSSL CA setup
#!/bin/zsh
cat >ca.cnf <<'EOF'
[ ca ]
default_ca = my_ca
[ my_ca ]
serial = ./serial.txt
database = ./index.txt
new_certs_dir = ./newcerts
certificate = ./ca.crt
@sddj
sddj / strongswan-macos.sh
Last active February 28, 2021 15:31
Setup and build StrongSwan with macOS proxy ARP support
#!/bin/zsh
set -e
brew install autoconf automake libtool pkg-config
brew install bison
brew install openssl@1.1
[ -d strongswan ] || git clone https://github.com/strongswan/strongswan.git strongswan
cd strongswan
git checkout 5.9.2
[ -f Makefile ] && make maintainer-clean
@sddj
sddj / keybase.md
Created February 28, 2020 19:47
keybase.md

Keybase proof

I hereby claim:

  • I am sddj on github.
  • I am aludianq (https://keybase.io/aludianq) on keybase.
  • I have a public key ASD_15TjJ8AL7PdF0Me_JPn6i7N4mtJlHZfiVS_zLsH3HAo

To claim this, I am signing this object: