How can I confirm my own certificate when using easywebdav?

I know how to connect to my owncloud using python using easywebdav .

I use a self-signed certificate and verify_ssl=False, but it makes me vulnerable to man-in-the-middle attacks, the only reason for using ssl in the first place.

I am using Fedora and trying to add my server certificate to $HOME/.pki/CA/cacert.pem, but it still does not work.

+1
source share
1 answer

$HOME/.pki/CA/cacert.pem. , python :

import ssl
import os
# get the https certificate
cert = ssl.get_server_certificate(('example.com', 443))
# append it to my personal chain
pem_path = os.path.expanduser('~/.pki/CA/cacert.pem')
with open(pem_path, 'a+') as f:
    f.write(cert)

easywebdav. Easywebdav . verify_ssl requests.Session.verify docs , (True ) CA_BUNDLE.

, :

import easywebdav
pem_path = os.path.expanduser('~/.pki/CA/cacert.pem')
webdav = easywebdav.connect('example.com', username='user', password='pass', 
                            protocol='https', port=443,
                            verify_ssl=pem_path)
...
+3

Source: https://habr.com/ru/post/1532797/


All Articles