config.py does not support netbox url with self-signed certificates #147

Closed
opened 2020-07-04 18:59:32 +02:00 by strus38 · 5 comments
strus38 commented 2020-07-04 18:59:32 +02:00 (Migrated from github.com)

Hi
could you update config.py, so it can work with self-signed certificates?
Proposal:

  • add an option to netbox-agent: --ignore-ssl-verify

Modifications (in addition of adding the option):

  • in config.py line line 1
import requests
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

then line 80:

if (no_ssl_verify):
    session = requests.Session()
    session.verify = False

nb = pynetbox.api(
     url=get_config().netbox.url,
     token=get_config().netbox.token
)
if (no_ssl_verify):
    nb.http_session = session
return nb

Thanks!

Hi could you update config.py, so it can work with self-signed certificates? Proposal: - add an option to netbox-agent: --ignore-ssl-verify Modifications (in addition of adding the option): - in config.py line line 1 ``` import requests import urllib3 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) ``` then line 80: ``` if (no_ssl_verify): session = requests.Session() session.verify = False nb = pynetbox.api( url=get_config().netbox.url, token=get_config().netbox.token ) if (no_ssl_verify): nb.http_session = session return nb ``` Thanks!
Solvik commented 2020-07-07 20:05:25 +02:00 (Migrated from github.com)

If you're able to propose a PR and test it, that would be very nice :)

If you're able to propose a PR and test it, that would be very nice :)
strus38 commented 2020-07-08 09:40:07 +02:00 (Migrated from github.com)

The PR 152 is opened. Feel free to merge or comment it.
Thanks!

The PR 152 is opened. Feel free to merge or comment it. Thanks!
Solvik commented 2020-07-08 09:41:20 +02:00 (Migrated from github.com)

many thanks for this addition !

many thanks for this addition !
strus38 commented 2020-07-08 10:12:04 +02:00 (Migrated from github.com)

Don't know how to fix the flake8 error. I let you fix it for me if you can.

Don't know how to fix the flake8 error. I let you fix it for me if you can.
Solvik commented 2020-07-11 15:32:48 +02:00 (Migrated from github.com)

#152 merged!

#152 merged!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: DGNum/netbox-agent#147
No description provided.