equal
deleted
inserted
replaced
541 sslcontext.options |= getattr(ssl, 'OP_SINGLE_ECDH_USE', 0) |
541 sslcontext.options |= getattr(ssl, 'OP_SINGLE_ECDH_USE', 0) |
542 |
542 |
543 # Use the list of more secure ciphers if found in the ssl module. |
543 # Use the list of more secure ciphers if found in the ssl module. |
544 if util.safehasattr(ssl, b'_RESTRICTED_SERVER_CIPHERS'): |
544 if util.safehasattr(ssl, b'_RESTRICTED_SERVER_CIPHERS'): |
545 sslcontext.options |= getattr(ssl, 'OP_CIPHER_SERVER_PREFERENCE', 0) |
545 sslcontext.options |= getattr(ssl, 'OP_CIPHER_SERVER_PREFERENCE', 0) |
|
546 # pytype: disable=module-attr |
546 sslcontext.set_ciphers(ssl._RESTRICTED_SERVER_CIPHERS) |
547 sslcontext.set_ciphers(ssl._RESTRICTED_SERVER_CIPHERS) |
|
548 # pytype: enable=module-attr |
547 |
549 |
548 if requireclientcert: |
550 if requireclientcert: |
549 sslcontext.verify_mode = ssl.CERT_REQUIRED |
551 sslcontext.verify_mode = ssl.CERT_REQUIRED |
550 else: |
552 else: |
551 sslcontext.verify_mode = ssl.CERT_NONE |
553 sslcontext.verify_mode = ssl.CERT_NONE |