Commit 45b39c53 authored by jkvis's avatar jkvis

Added client certificate support

parent a9770390
......@@ -9,7 +9,11 @@ from flask.ext.sqlalchemy import SQLAlchemy
from werkzeug.exceptions import (default_exceptions, HTTPException)
DEFAULT_MAIL_SENDER = 'transfer@lgtc.nl'
CERT_FILE = '/srv/transfer.cert.pem'
KEY_FILE = '/srv/transfer.key.pem'
CERT = (CERT_FILE, KEY_FILE)
DEFAULT_MAIL_SENDER = 'root@humgen.nl'
MAIL_SERVER = '127.0.0.1'
MAIL_PORT = 25
......
......@@ -22,7 +22,8 @@ from functools import wraps
from werkzeug import secure_filename
from transfer import (db, app, mail, TRANSFER_INITIATED, TRANSFER_COMPLETED,
TRANSFER_CANCELLED, TRANSFER_FAILED, TRANSFER_UPLOADED)
TRANSFER_CANCELLED, TRANSFER_FAILED, TRANSFER_UPLOADED, DEFAULT_MAIL_SENDER,
CERT)
from transfer.models import (User, Transfer, MetaFile, UploadFile, md5sum)
......@@ -460,6 +461,7 @@ def upload(user, transfer_id):
try:
result = requests.post(user.action,
json={'transfer_id': transfer.tid},
cert=CERT,
verify=False)
if result.status_code < 200 or result.status_code > 299:
logging.error(user.action + transfer.tid + ' failed')
......@@ -475,7 +477,7 @@ def upload(user, transfer_id):
title = 'Transfer ' + transfer.tid + ' completed'
if user.action is not None and not success:
title += ', but notification failed'
msg = Message(title, sender='root@humgen.nl',
msg = Message(title, sender=DEFAULT_MAIL_SENDER,
recipients=[user.email])
try:
mail.send(msg)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment