Skip to content

Instantly share code, notes, and snippets.

@NCatalani
Created September 22, 2023 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NCatalani/a4a38d5619858ff7fc4eafd409fe55b2 to your computer and use it in GitHub Desktop.
Save NCatalani/a4a38d5619858ff7fc4eafd409fe55b2 to your computer and use it in GitHub Desktop.
Forti VPN SAML CLI workaround using Selenium
selenium==4.10.0
webdriver-manager>=3.8.6
host = foo.bar.com
port = 443
trusted-cert = 015d40adce838fd3dbcdaf7d8d7438aabb6c57e5e9ab020dbb536fff7eba2e1d
#!/usr/bin/env bash
# Remember to do the following:
# Replace VPN_HOST inside get_cookie.py with your real VPN host
# Replace both host and trusted cert inside vpn.config
# Run vpn_connect.sh
REQUIREMENTS_FILE="requirements.txt"
CONFIG_FILE="vpn.config"
ENV_DIR=".env"
# Creates vevn if it doesn't exist
[[ ! -d .env ]] && python3 -m venv ${ENV_DIR}
source ${ENV_DIR}/bin/activate && pip install -r ${REQUIREMENTS_FILE}
# Retrieves the token
python3 get_cookie.py > .vpn_cookie || exit 1
# Connects to VPN
COOKIE=$(cat .vpn_cookie)
sudo openfortivpn -v -c $CONFIG_FILE --cookie="SVPNCOOKIE=${COOKIE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment