Fix errors ‘socket ssl wrapping error: [Errno 104] Connection reset by peer’
Fix python ldap3 connect active directory errors ‘socket ssl wrapping error: [Errno 104] Connection reset by peer’ in Ubuntu 20.04
edit file /etc/ssl/openssl.cnf
- You need to add this to the beginning of your config file
openssl_conf = default_conf
- And then this to the end line
[ default_conf ]
ssl_conf = ssl_sect[ssl_sect]
system_default = ssl_default_sect[ssl_default_sect]
MinProtocol = TLSv1
CipherString = DEFAULT:@SECLEVEL=1
- or create your openssl.cnf file and export path
export OPENSSL_CONF=/path/to/my/openssl.cnf
. Dockerfile example
FROM python:3.9.16-slim-buster
WORKDIR /app
COPY . .
# downgrade TLS for SQL Server 2008 to connect (pre SP3)
RUN sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/' /etc/ssl/openssl.cnf \
&& sed -i 's/CipherString = DEFAULT@SECLEVEL=2/CipherString = DEFAULT@SECLEVEL=1/' /etc/ssl/openssl.cnf
# RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
CMD uvicorn main:app --host 0.0.0.0 --port 8000