{"id":15813771,"url":"https://github.com/tuankiet-hcmc/autoconnectopenvpnmac","last_synced_at":"2026-04-30T00:06:11.759Z","repository":{"id":254256157,"uuid":"845847591","full_name":"tuankiet-hcmc/AutoConnectOpenVPNMac","owner":"tuankiet-hcmc","description":"This project provides a macOS shortcut application that automates the process of connecting to OpenVPN using an OTP (One-Time Password) generated from a secret key stored in the macOS Keychain.","archived":false,"fork":false,"pushed_at":"2024-08-22T09:31:10.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-06T04:05:34.939Z","etag":null,"topics":["auto","macos","openvpn","shortcut"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tuankiet-hcmc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-22T03:31:00.000Z","updated_at":"2024-08-22T09:31:13.000Z","dependencies_parsed_at":"2025-01-02T20:30:50.078Z","dependency_job_id":null,"html_url":"https://github.com/tuankiet-hcmc/AutoConnectOpenVPNMac","commit_stats":null,"previous_names":["tuankiet-hcmc/autoconnectopenvpnmac"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuankiet-hcmc%2FAutoConnectOpenVPNMac","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuankiet-hcmc%2FAutoConnectOpenVPNMac/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuankiet-hcmc%2FAutoConnectOpenVPNMac/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuankiet-hcmc%2FAutoConnectOpenVPNMac/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tuankiet-hcmc","download_url":"https://codeload.github.com/tuankiet-hcmc/AutoConnectOpenVPNMac/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246569006,"owners_count":20798341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auto","macos","openvpn","shortcut"],"created_at":"2024-10-05T04:05:42.012Z","updated_at":"2026-04-30T00:06:11.712Z","avatar_url":"https://github.com/tuankiet-hcmc.png","language":"Python","funding_links":["https://ko-fi.com/ohteik"],"categories":[],"sub_categories":[],"readme":"# OpenVPN Auto Connect with OTP\n\nThis project provides a macOS shortcut application that automates the process of connecting to OpenVPN using an OTP (One-Time Password) generated from a secret key stored in the macOS Keychain.\n\n## Installation and Setup\n\n### 1. Install OpenVPN Connect\n\nFirst, install the OpenVPN Connect client on your macOS using Homebrew:\n\n```bash\nbrew install openvpn-connect\n```\n\n### 2. Open OpenVPN and Import VPN Profile\n\n- Launch the OpenVPN Connect application.\n- Import your VPN profile into OpenVPN Connect.\n\n### 3. Configure Keychain for VPN Profile\n\nIf your VPN profile is user-locked and requires a password, you need to set up the macOS Keychain to store your VPN credentials:\n\n1. Store your secret key in the Keychain:\n\n   ```bash\n   security add-generic-password -a \"username\" -s \"vpn_secret\" -w \"your-secret-key\"\n   ```\n\n2. Store your PIN in the Keychain:\n\n   ```bash\n   security add-generic-password -a \"username\" -s \"vpn_pin\" -w \"your-pin\"\n   ```\n\nMake sure to replace `\"username\"`, `\"vpn_secret\"`, `\"vpn_pin\"`, `\"your-secret-key\"`, and `\"your-pin\"` with your actual values.\n\n### 4. Customize the Scripts\n\nYou need to customize the Python and AppleScript files for your environment:\n\n1. **gen_otp.py**:\n   - Update the following variables with your own values:\n     - `username`\n     - `vpn_secret`\n     - `vpn_pin`\n\n2. **connect_vpn.applescript**:\n   - Update the paths to point to the correct location of your Python installation and the `gen_otp.py` script:\n     ```applescript\n     set otpCode to do shell script \"path/to/python /path/to/gen_otp.py\"\n     ```\n\n### 5. Create a Shortcut in the Menu Bar and Pin to Dock\n\n1. Open the Shortcuts app on your Mac.\n2. Select the \"Menu Bar\" section.\n3. Create a new shortcut.\n4. Add the \"Run AppleScript\" action.\n5. Copy the contents of `connect_vpn.applescript` into the script area, making sure you've already customized the paths.\n6. Save the shortcut, and optionally change its icon and name as desired.\n7. To pin the shortcut to the Dock for quick access, drag the saved shortcut to the Dock.\n\n### 6. Grant Accessibility Permissions\n\nFor the AppleScript to control the OpenVPN Connect application, you need to grant Accessibility permissions:\n\n1. Go to **System Settings** \u003e **Privacy \u0026 Security** \u003e **Accessibility**.\n2. Click the lock to make changes and authenticate with your password.\n3. Find the Shortcuts app and ensure it's enabled.\n\n## Usage\n\n1. Click the shortcut in the menu bar or from the Dock.\n2. The shortcut will automatically generate the OTP, launch OpenVPN Connect, and connect to your VPN using the generated OTP.\n\n## Notes\n\n- Ensure that the OpenVPN profile is already configured in OpenVPN Connect.\n- The script assumes that OpenVPN Connect is already installed and configured on your system.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n## Say Thank You\n\nIf you find this project useful and would like to support its development, consider buying me a coffee: [Ko-fi - Oh Teik](https://ko-fi.com/ohteik).\n\n[\u003cimg style=\"float:left\" src=\"https://user-images.githubusercontent.com/14358394/115450238-f39e8100-a21b-11eb-89d0-fa4b82cdbce8.png\" width=\"200\"\u003e](https://ko-fi.com/ohteik)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuankiet-hcmc%2Fautoconnectopenvpnmac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftuankiet-hcmc%2Fautoconnectopenvpnmac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuankiet-hcmc%2Fautoconnectopenvpnmac/lists"}