parent
9d88426891
commit
dd0794945d
@ -0,0 +1,11 @@
|
||||
from string import Template
|
||||
|
||||
def gen_config(client, ip):
|
||||
text = ""
|
||||
with open("input/config", "r") as input_file:
|
||||
for line in input_file.readlines():
|
||||
text+=line
|
||||
|
||||
config = Template(text)
|
||||
with open("output/{}.ovpn".format(client), "w") as output_file:
|
||||
output_file.write(config.substitute(ip=ip, client=client))
|
@ -0,0 +1,18 @@
|
||||
client
|
||||
dev tun
|
||||
proto udp
|
||||
remote $ip 1194
|
||||
resolv-retry infinite
|
||||
nobind
|
||||
user openvpn
|
||||
group openvpn
|
||||
persist-key
|
||||
persist-tun
|
||||
ca ca.cert
|
||||
cert $client.crt
|
||||
key $client.key
|
||||
remote-cert-tls server
|
||||
tls-auth ta.key 1
|
||||
cipher AES-128-CBC
|
||||
comp-lzo
|
||||
verb 3
|
@ -0,0 +1,13 @@
|
||||
from flask import Flask, redirect, request, render_template
|
||||
from gentemp import gen_config
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template("base.html")
|
||||
|
||||
@app.route("/gen", methods=["POST"])
|
||||
def gen():
|
||||
gen_config(request.form["client"], request.form["ip"])
|
||||
return redirect("/")
|
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>OVPNConfigurator</title>
|
||||
</head>
|
||||
<body>
|
||||
<form method="post" action="gen">
|
||||
<p>IP:<input type="text" name="ip"></p>
|
||||
<p>Client:<input type="text" name="client"></p>
|
||||
<input type="submit">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in new issue