forked from DavidWittman/csrgenerator.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
31 lines (19 loc) · 632 Bytes
/
Copy pathapp.py
File metadata and controls
31 lines (19 loc) · 632 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
import os
from flask import Flask, request, Response, render_template
from csr import CsrGenerator
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/security')
def security():
return render_template('security.html')
@app.route('/generate', methods=['POST'])
def generate_csr():
csr = CsrGenerator(request.form)
response = b'\n'.join([csr.csr, csr.private_key])
return Response(response, mimetype='text/plain')
if __name__ == '__main__':
port = int(os.environ.get('FLASK_PORT', 5555))
app.run(host='0.0.0.0', port=port)