{"id":21423196,"url":"https://github.com/rwlist/ovpn-bot","last_synced_at":"2025-07-12T02:38:49.054Z","repository":{"id":57515500,"uuid":"239031720","full_name":"rwlist/ovpn-bot","owner":"rwlist","description":"Simple telegram bot for automatic OpenVPN configuration","archived":false,"fork":false,"pushed_at":"2022-03-18T14:10:22.000Z","size":47,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T02:01:15.258Z","etag":null,"topics":["bot","docker","openvpn","openvpn-configuration","openvpn-installer","openvpn-server","self-hosted","telegram-bot"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rwlist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-07T22:11:43.000Z","updated_at":"2024-06-20T02:01:15.259Z","dependencies_parsed_at":"2022-08-30T04:20:56.190Z","dependency_job_id":null,"html_url":"https://github.com/rwlist/ovpn-bot","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwlist%2Fovpn-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwlist%2Fovpn-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwlist%2Fovpn-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwlist%2Fovpn-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwlist","download_url":"https://codeload.github.com/rwlist/ovpn-bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225964911,"owners_count":17552426,"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":["bot","docker","openvpn","openvpn-configuration","openvpn-installer","openvpn-server","self-hosted","telegram-bot"],"created_at":"2024-11-22T21:14:46.336Z","updated_at":"2024-11-22T21:14:46.966Z","avatar_url":"https://github.com/rwlist.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ovpn-bot\nSimple telegram bot for automatic OpenVPN configuration\n\n## How to install\n\n### Create configuration\n\nCreate `docker-compose.yml` with the following content:\n\n```yml\nversion: '3.7'\nservices:\n  bot:\n    image: arthurwow/ovpnbot\n    env_file:\n      - .env\n    volumes:\n      - /var/run/docker.sock:/var/run/docker.sock:ro\n    restart: unless-stopped\n```\n\nAlso create `.env` file with configuration:\n\n```env\nADMIN_TELEGRAM_ID=\nBOT_TOKEN=\n```\n\nADMIN_TELEGRAM_ID is your Telegram ID, which will be used to manage users. Use https://t.me/userinfobot to get it. Bot will reply with a message with your ID:\n\n```\n@ivanonov\nId: 123456789 \u003c==== USE THIS ID TO WRITE IN .env FILE\nFirst: Ivan\nLast: Ivanov\nLang: en\n```\n\nBOT_TOKEN is a Telegram token issued by https://t.me/BotFather. You should talk to this bot to create a new bot and get a token for it.\n\nSo, configured `.env` file should look like this:\n\n```env\nADMIN_TELEGRAM_ID=123456789\nBOT_TOKEN=1231231231:AAAAAAAAABBBBCCCCCCCCCCCCCC\n```\n\n### Start bot\n\nWhen configuration is written to `.env` file, start the bot:\n\n```bash\n# Start the bot in the background\ndocker-compose up -d\n\n# Now bot should be working, check if it is:\ndocker-compose ps -a           \n\n# If output is like this, State is Up, then bot is running\n# \n#      Name        Command   State   Ports\n# ----------------------------------------\n# ovpn-bot_bot_1   ./app     Up       \n\n# Get public IP address of the instance, to use it later for \n# VPN configuration. Remember this IP address for bot init!\ncurl ifconfig.me\n```\n\nNow it's time to setup VPN via bot.\n\n### Use bot\n\nFirst of all, write something to your bot. It should reply with help message. If not, something was wrong on the previous step.\n\nIf bot is working, you can init your VPN server. To do that, write init command to the bot. You must replace 0.0.0.0 with the actual IP address of your VPN server, which can be obtained by running `curl ifconfig.me` on the same instance.\n```\n/init tcp://0.0.0.0:443\n```\n\nAfter some time to generate keys (it can take a while, sending dots in PM), you should see a message like this:\n\n```\n....\nAn updated CRL has been created.\nCRL file: /etc/openvpn/pki/crl.pem\n\n\nExecuting command: `docker run -v ovpn_data:/etc/openvpn -d --restart=always --name ovpn_udp -p 34231:1194/udp --cap-add=NET_ADMIN kylemanna/openvpn ovpn_run --proto udp`fb79eba733f495b79878e3bc66710421a9ad0a931d217bc85c06e26fa098e659\nExecuting command: `docker run -v ovpn_data:/etc/openvpn -d --restart=always --name ovpn_tcp -p 34231:1194/tcp --cap-add=NET_ADMIN kylemanna/openvpn ovpn_run --proto tcp`dc32c846369adf2a08dfd629bcb021ce23e709b571fb794c64898edecf3708ac\nAll done, init completed!\n```\n\nThis message means that VPN is now running!\n\nThe last step is to create user profiles. This is very simple, you just need to write `/generate profile_name` to create .ovpn profile with the name `profile_name`. You can create as many profiles as you want.\n\n\n\u003cdetails\u003e\n\u003csummary\u003eHow to run bot without docker-compose\u003c/summary\u003e\n\n## Installation\n\n```bash\ndocker run -d \\\n    --name ovpn-tg-bot \\\n    --volume /var/run/docker.sock:/var/run/docker.sock:ro \\\n    --env ADMIN_TELEGRAM_ID=123456789 \\\n    --env BOT_TOKEN=1231231231:AAAAAAAAABBBBCCCCCCCCCCCCCC \\\n    arthurwow/ovpnbot\n```\nor\n```bash\ndocker run -d --name ovpn-tg-bot --volume /var/run/docker.sock:/var/run/docker.sock:ro --env ADMIN_TELEGRAM_ID=123456789 --env BOT_TOKEN=1231231231:AAAAAAAAABBBBCCCCCCCCCCCCCC arthurwow/ovpnbot\n```\n\n**ADMIN_TELEGRAM_ID** is a comma-separated list of the bot admins' Telegram IDs\n\n### Proxy\n\nIf you running this bot in Russia, you might want to use proxy to run this bot. You can do this easily with HTTP_PROXY envvar, example:\n\n```\ndocker run -d \\\n    --name ovpn-tg-bot \\\n    --volume /var/run/docker.sock:/var/run/docker.sock:ro \\\n    --env HTTP_PROXY=socks5://user:pass@proxy.example.com:1080 \\\n    --env ADMIN_TELEGRAM_ID=123456789 \\\n    --env BOT_TOKEN=1231231231:AAAAAAAAABBBBCCCCCCCCCCCCCC \\\n    arthurwow/ovpnbot\n```\n\n\u003c/details\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwlist%2Fovpn-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwlist%2Fovpn-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwlist%2Fovpn-bot/lists"}