Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certificate verify failed: unable to get local issuer certificate #142

Open
javivu opened this issue Jul 8, 2024 · 5 comments
Open

Certificate verify failed: unable to get local issuer certificate #142

javivu opened this issue Jul 8, 2024 · 5 comments

Comments

@javivu
Copy link

javivu commented Jul 8, 2024

Hi to all!

Trying to execute "./nb-dt-import.py" i got the error:
urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)

My deploy:

  • virtual machine with Ubuntu 22.04.4 LTS
  • Apache2 + gunicorn + Https with let's encrypt SSL cert-
  • NetBox 4.0.5
  • python 3.10.12
  • django 5.0.6
  • PostgreSQL 14.12

My .env:
NETBOX_URL=https://netbox.mydomain.com/ NETBOX_TOKEN=******* REPO_URL=https://github.com/netbox-community/devicetype-library.git REPO_BRANCH=master IGNORE_SSL_ERRORS=False

If I try to use IGNORE_SSL_ERRORS=True another error:
pynetbox.core.query.RequestError: The request failed with code 403 Forbidden: {'detail': 'Authentication credentials were not provided.'}

The script and netbox are installed in the same server.

@julianfirminger-united
Copy link

I have the same issue. it's like it is ignoroing the NETBOX_TOKEN var in the env file.

@javivu
Copy link
Author

javivu commented Jul 11, 2024

@julianfirminger-united , you have me an idea, we check the code.
The problem is in:
File "/Device-Type-Library-Import/netbox_api.py", line 50, in verify_compatibility version_split = [int(x) for x in self.netbox.version.split('.')]
and
File "/Device-Type-Library-Import/venv/lib/python3.10/site-packages/pynetbox/core/api.py", line 111, in version ).get_version()
The function get_version() from Pynetbox, don't use token?

@javivu
Copy link
Author

javivu commented Jul 12, 2024

@julianfirminger-united I do a "dirty" workaround for the momment,
In the file netbox_api.py I modify the function verify_compatibility() because my version of netbox is NetBox 4.0.5

def verify_compatibility(self):
        # nb.version should be the version in the form '3.2'
        #version_split = [int(x) for x in self.netbox.version.split('.')]

        # Later than 3.2
        # Might want to check for the module-types entry as well?
        #if version_split[0] > 3 or (version_split[0] == 3 and version_split[1] >= 2):
        self.modules = True

@julianfirminger-united
Copy link

@javivu can confirm this works. Thanks for the work!

@sliweq
Copy link

sliweq commented Sep 19, 2024

@julianfirminger-united I do a "dirty" workaround for the momment,
In the file netbox_api.py I modify the function verify_compatibility() because my version of netbox is NetBox 4.0.5

def verify_compatibility(self):
        # nb.version should be the version in the form '3.2'
        #version_split = [int(x) for x in self.netbox.version.split('.')]

        # Later than 3.2
        # Might want to check for the module-types entry as well?
        #if version_split[0] > 3 or (version_split[0] == 3 and version_split[1] >= 2):
        self.modules = True

Commenting those two lines helped me. Thanks for the help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants