Use a more standard location for certificates

This commit is contained in:
rnhmjoj 2016-01-01 23:56:33 +01:00
parent 7c367b7b8a
commit eee3ee1619

View File

@ -75,10 +75,8 @@ def serve(address, port, tls_dir, upload):
bind = (address, port) bind = (address, port)
try: try:
if upload: handler = UploadHandler if upload else http.SimpleHTTPRequestHandler
server = http.HTTPServer(bind, UploadHandler) server = http.HTTPServer(bind, handler)
else:
server = http.HTTPServer(bind, http.SimpleHTTPRequestHandler)
if use_tls: if use_tls:
try: try:
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
@ -120,9 +118,9 @@ def main():
help='only accept and save file as POST requests') help='only accept and save file as POST requests')
parser.add_argument('-t', '--tls', parser.add_argument('-t', '--tls',
type=str, dest='tls_dir', metavar='DIR', type=str, dest='tls_dir', metavar='DIR',
default='/usr/local/etc/openssl', default='/etc/ssl/certs',
help='cert/key pair directory. Must be PEM ' help='cert/key pair directory. Must be PEM '
'formatted and named https-key.pem, https-cert.pem ' 'formatted and named https-key.pem, https-cert.pem '
'(default: /usr/local/etc/openssl)') '(default: /etc/ssl/certs)')
args = parser.parse_args() args = parser.parse_args()
serve(**vars(args)) serve(**vars(args))