imperva / incapsula-logs-downloader

A Python script for downloading log files from Incapsula
MIT License
30 stars 35 forks source link

proxy issue #4

Closed hmhkyaw13 closed 4 years ago

hmhkyaw13 commented 5 years ago

not working behind the proxy ERROR An error has occur while making a open connection to https://logs1.incapsula.com/xxxx/logs.index. Traceback (most recent call last): Below is the Config file [SETTINGS] APIID=1111 APIKEY=xxxxx-xxxxx-xxxxx-xxxx-xxx PROCESS_DIR= /tmp/processed/ BASEURL=https://logs1.incapsula.com/xxx_xxxxxx/ USEPROXY=YES PROXYSERVER=pxy.home.com:8080 SAVE_LOCALLY=YES SYSLOG_ENABLE=NO SYSLOG_ADDRESS= SYSLOG_PORT= USE_CUSTOM_CA_FILE=NO CUSTOM_CA_FILE=

OmerLitov commented 5 years ago

sounds like an issue in the proxy, not in the script

dragazan commented 4 years ago

After hopelessly trying to make the original code work, I've found out that there is indeed a bug (https://stackoverflow.com/a/41878564) in the original urllib2 SSLContext code which means the proxy won't ever be used; the proposed workaround given in the SO link didn't work.

I've had to spend a bit of time to migrate the code from urllib2 to urllib3 so that it now works via a proxy whenever there is one configured in the "Settings.Config" configuration file and I've successfully tested it for a few days now and it's working very well; just like the original, my code will also work when no proxy has been specified and also caters for when a user has/hasn't specified a custom CA file.

It would be great if you could please accept this and merge so other customers don't have to face this same issue in their environments.

Razvan Ragazan

AaronSeibert commented 4 years ago

Resolved with 205634105ab380f481170d4843d6ef06cc70cff9 - this also closed PR #7