Created
September 22, 2023 13:18
-
-
Save NCatalani/a4a38d5619858ff7fc4eafd409fe55b2 to your computer and use it in GitHub Desktop.
Forti VPN SAML CLI workaround using Selenium
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
selenium==4.10.0 | |
webdriver-manager>=3.8.6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
host = foo.bar.com | |
port = 443 | |
trusted-cert = 015d40adce838fd3dbcdaf7d8d7438aabb6c57e5e9ab020dbb536fff7eba2e1d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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