Skip to content

Instantly share code, notes, and snippets.

@jeremysells
Last active May 6, 2021 12:33
Show Gist options
  • Save jeremysells/45898dd0421fac8698fe6fbc2ace0633 to your computer and use it in GitHub Desktop.
Save jeremysells/45898dd0421fac8698fe6fbc2ace0633 to your computer and use it in GitHub Desktop.
Creates an Untangle compatible OpenVPN client from an inline OpenVPN config
#!/usr/bin/env bash
set -e
# MIT licensed
# This script is AS-IS where is (no warrenty, liability etc - see the license for full details)
# see: https://opensource.org/licenses/MIT and/or https://en.wikipedia.org/wiki/MIT_License
# About:
# This file converts a single file (client.conf) with inline certs into an Untangle compatible client (to be imported)
# I have spent a lot of time trying to get the format correct so that Untangle accepts it (would be good if it would accept a .conf file!)
# Untangle = https://www.untangle.com/
# Instructions:
# 1) Create a new dir (e.g. on your desktop) and inside it:
# 2) Add this script (and +x it)
# 3) Add a new file (client.conf) and put your clients config inside (make sure it has inline certs!)
# 4) Run the script. You should have a zip file you can import into Untangle
# SETTINGS
INTERNAL_NAME="vpn_example_com---client_name"
CONFIG_FILE="client.conf"
# VARS
ZIP_FILE="${INTERNAL_NAME}.zip"
# Remove the existing dir if exists
if [ -d 'untangle-vpn' ]; then
rm -R 'untangle-vpn'
fi
# Remove the existing file
if [ -f ${ZIP_FILE} ]; then
rm ${ZIP_FILE}
fi
# Make the dir
mkdir 'untangle-vpn'
# Copy config into the Untangle specific layout
cp ${CONFIG_FILE} untangle-vpn/${INTERNAL_NAME}.conf
cp ${CONFIG_FILE} untangle-vpn/${INTERNAL_NAME}.ovpn
# Create the zip
zip ${ZIP_FILE} untangle-vpn/*
# Cleanup
rm -R 'untangle-vpn'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment