Files
docker-deluge-openvpn/openvpn/ghostpath/create-certs/create-certs.py
2019-04-11 16:39:09 -04:00

29 lines
708 B
Python

import pandas as pd
df = pd.read_csv('GhostPath_URLS.csv', header=None,
names=['country', 'city', 'url'])
df['location'] = (df['country'].map(str) + '-' + df['city']).map(
lambda x: x.replace(' ', '-'))
urls_by_location = df.groupby('location')['url'].apply(list).reset_index()
tail = """
auth-user-pass /config/openvpn-credentials.txt
client
redirect-gateway
remote-cert-tls server
cipher AES-256-CBC
proto udp
dev tun
nobind
ca /etc/openvpn/ghostpath/ca.crt
"""
def create_cert(row):
with open(f'{row["location"]}.ovpn', 'w') as f:
for url in row['url']:
f.write(f'remote {url} 443 udp\n')
f.write(tail)
urls_by_location.apply(create_cert, axis=1)