Mercurial > p > roundup > code
comparison roundup/scripts/roundup_server.py @ 6502:7fb13dc67a41
roundup-server native SSL support only TLS 1.2.
1.1 was suported but is deprecated.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 30 Sep 2021 19:17:56 -0400 |
| parents | 1f2f7c0b8968 |
| children | a036712c96f4 |
comparison
equal
deleted
inserted
replaced
| 6501:89c4fb277a49 | 6502:7fb13dc67a41 |
|---|---|
| 118 cert.get_subject().O = 'Roundup Dummy Certificate' | 118 cert.get_subject().O = 'Roundup Dummy Certificate' |
| 119 cert.get_issuer().CN = 'Roundup Dummy Certificate Authority' | 119 cert.get_issuer().CN = 'Roundup Dummy Certificate Authority' |
| 120 cert.get_issuer().O = 'Self-Signed' | 120 cert.get_issuer().O = 'Self-Signed' |
| 121 cert.set_pubkey(pkey) | 121 cert.set_pubkey(pkey) |
| 122 cert.sign(pkey, 'sha512') | 122 cert.sign(pkey, 'sha512') |
| 123 ctx = SSL.Context(OpenSSL.SSL.TLSv1_1_METHOD) | 123 ctx = SSL.Context(OpenSSL.SSL.TLSv1_2_METHOD) |
| 124 ctx.use_privatekey(pkey) | 124 ctx.use_privatekey(pkey) |
| 125 ctx.use_certificate(cert) | 125 ctx.use_certificate(cert) |
| 126 | 126 |
| 127 return ctx | 127 return ctx |
| 128 | 128 |
| 131 def __init__(self, server_address, HandlerClass, ssl_pem=None): | 131 def __init__(self, server_address, HandlerClass, ssl_pem=None): |
| 132 assert SSL, "pyopenssl not installed" | 132 assert SSL, "pyopenssl not installed" |
| 133 http_.server.HTTPServer.__init__(self, server_address, HandlerClass) | 133 http_.server.HTTPServer.__init__(self, server_address, HandlerClass) |
| 134 self.socket = socket.socket(self.address_family, self.socket_type) | 134 self.socket = socket.socket(self.address_family, self.socket_type) |
| 135 if ssl_pem: | 135 if ssl_pem: |
| 136 ctx = SSL.Context(SSL.TLSv1_1_METHOD) | 136 ctx = SSL.Context(SSL.TLSv1_2_METHOD) |
| 137 ctx.use_privatekey_file(ssl_pem) | 137 ctx.use_privatekey_file(ssl_pem) |
| 138 ctx.use_certificate_file(ssl_pem) | 138 ctx.use_certificate_file(ssl_pem) |
| 139 else: | 139 else: |
| 140 ctx = auto_ssl() | 140 ctx = auto_ssl() |
| 141 self.ssl_context = ctx | 141 self.ssl_context = ctx |
