vericast / conda-mirror

Mirror upstream conda channels
BSD 3-Clause "New" or "Revised" License
72 stars 60 forks source link

SSL Issue when creating mirror #61

Open richardcrossley opened 7 years ago

richardcrossley commented 7 years ago

On a fresh install of Miniconda on Linux Mint 18, 64 bit.

Attempting to create a mirror of conda-forge using "conda-mirror".

A 20 GB file system was prepared and mounted:

richard@goldlaptop /CondaMirror $ df -h ./
Filesystem                                  Size  Used Avail Use% Mounted on
/dev/mapper/vg_goldlaptop_b-lv_CondaMirror   20G   44M   19G   1% /CondaMirror

Conda mirror was installed:

conda install conda-mirror -c conda-forge

A mirror configuration file was created:

richard@goldlaptop /CondaMirror $ cat conda-mirror.conf 
blacklist:
    - license: "*agpl*"

whitelist:
    - name: system

An attempt to create a mirror of conda-forge was made, which gave an SSL error.

richard@goldlaptop /CondaMirror $ conda-mirror --upstream-channel conda-forge --target-directory /CondaMirror/conda-forge --platform linux-64 --config /CondaMirror/conda-mirror.conf 
Log level set to ERROR
Traceback (most recent call last):
  File "/home/richard/miniconda3/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 441, in wrap_socket
    cnx.do_handshake()
  File "/home/richard/miniconda3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1716, in do_handshake
    self._raise_ssl_error(self._ssl, result)
  File "/home/richard/miniconda3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1449, in _raise_ssl_error
    raise SysCallError(-1, "Unexpected EOF")
OpenSSL.SSL.SysCallError: (-1, 'Unexpected EOF')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/richard/miniconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/home/richard/miniconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 346, in _make_request
    self._validate_conn(conn)
  File "/home/richard/miniconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 850, in _validate_conn
    conn.connect()
  File "/home/richard/miniconda3/lib/python3.6/site-packages/urllib3/connection.py", line 326, in connect
    ssl_context=context)
  File "/home/richard/miniconda3/lib/python3.6/site-packages/urllib3/util/ssl_.py", line 329, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/home/richard/miniconda3/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 448, in wrap_socket
    raise ssl.SSLError('bad handshake: %r' % e)
ssl.SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/richard/miniconda3/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/home/richard/miniconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/richard/miniconda3/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='conda.anaconda.org', port=443): Max retries exceeded with url: //conda-forge/linux-64/airflow-1.8.0-py35_1.tar.bz2 (Caused by SSLError(SSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')",),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/richard/miniconda3/bin/conda-mirror", line 6, in <module>
    sys.exit(conda_mirror.conda_mirror.cli())
  File "/home/richard/miniconda3/lib/python3.6/site-packages/conda_mirror/conda_mirror.py", line 261, in cli
    main(**_parse_and_format_args())
  File "/home/richard/miniconda3/lib/python3.6/site-packages/conda_mirror/conda_mirror.py", line 685, in main
    _download(url, download_dir)
  File "/home/richard/miniconda3/lib/python3.6/site-packages/conda_mirror/conda_mirror.py", line 380, in _download
    ret = requests.get(url, stream=True)
  File "/home/richard/miniconda3/lib/python3.6/site-packages/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "/home/richard/miniconda3/lib/python3.6/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/richard/miniconda3/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/richard/miniconda3/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/home/richard/miniconda3/lib/python3.6/site-packages/requests/adapters.py", line 506, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='conda.anaconda.org', port=443): Max retries exceeded with url: //conda-forge/linux-64/airflow-1.8.0-py35_1.tar.bz2 (Caused by SSLError(SSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')",),))
richard@goldlaptop /CondaMirror $ 

The connection to the internet is working well at this time.

Can you review my actions and suggest what I may have done incorrectly.

ericdill commented 6 years ago

Hi @richardcrossley -- I have little experience with SSL. I really have no idea what the problem here is. Did you end up figuring out a workaround?

Sincere apologies for never responding to this issue. I missed it in the flood of github notifications 😞