mirror of https://github.com/scrapy/scrapy.git
Use OpenSSL default ciphers
Twisted default TLS options restricts the ciphers list a bit -- "a secure default"
e38cc25a67/src/twisted/internet/_sslverify.py (L1861)
We want to be a bit more permissive with Scrapy
(at least as permissive as Scrapy 1.0 was, and which used a default OpenSSL Context)
See https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER_STRINGS
OpenSSL's 'DEFAULT' seems to be reasonable enough.
Fixes #2311
This commit is contained in:
parent
3235bfeb1e
commit
c3411373e8
|
|
@ -13,7 +13,7 @@ try:
|
|||
from twisted.web.client import BrowserLikePolicyForHTTPS
|
||||
from twisted.web.iweb import IPolicyForHTTPS
|
||||
|
||||
from scrapy.core.downloader.tls import ScrapyClientTLSOptions
|
||||
from scrapy.core.downloader.tls import ScrapyClientTLSOptions, DEFAULT_CIPHERS
|
||||
|
||||
|
||||
@implementer(IPolicyForHTTPS)
|
||||
|
|
@ -46,7 +46,9 @@ try:
|
|||
# not calling super(..., self).__init__
|
||||
return CertificateOptions(verify=False,
|
||||
method=getattr(self, 'method',
|
||||
getattr(self, '_ssl_method', None)))
|
||||
getattr(self, '_ssl_method', None)),
|
||||
fixBrokenPeers=True,
|
||||
acceptableCiphers=DEFAULT_CIPHERS)
|
||||
|
||||
# kept for old-style HTTP/1.0 downloader context twisted calls,
|
||||
# e.g. connectSSL()
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ try:
|
|||
SSL_CB_HANDSHAKE_START = 0x10
|
||||
SSL_CB_HANDSHAKE_DONE = 0x20
|
||||
|
||||
from twisted.internet.ssl import AcceptableCiphers
|
||||
from twisted.internet._sslverify import (ClientTLSOptions,
|
||||
_maybeSetHostNameIndication,
|
||||
verifyHostname,
|
||||
|
|
@ -60,6 +61,8 @@ try:
|
|||
'from host "{}" (exception: {})'.format(
|
||||
self._hostnameASCII, repr(e)))
|
||||
|
||||
DEFAULT_CIPHERS = AcceptableCiphers.fromOpenSSLCipherString('DEFAULT')
|
||||
|
||||
except ImportError:
|
||||
# ImportError should not matter for older Twisted versions
|
||||
# as the above is not used in the fallback ScrapyClientContextFactory
|
||||
|
|
|
|||
Loading…
Reference in New Issue