-
Notifications
You must be signed in to change notification settings - Fork 64
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
MacOS - SSL verification fails with: unable to get local issuer certificate #154
Comments
@kbreit Thanks for reporting this issue. This is likely caused by Thanks. needs_info |
@Akasurde That helped quite a bit. I'm now receiving another error. Do you happen to know how to resolve this properly?
|
This may not be SSL related, are you sure the node can reach e7vmw0vic05.datalinklabs.local? |
Actually the I used Homebrew to install Python and it works fine. If you use the one from xcode, it may be more something like: https://qiita.com/0_a_e/items/d0c7287ea71b555f9ffd
|
I use pyenv. Do you know where that is? |
Yes, but unless you used a package manager like Brew to pull Python, you probably use the Python from |
|
My pyenv virtual environment is stored in |
Sorry, this is way above my knowledge of MacOS. |
Hi @kbreit, Could you try the following patch? diff --git a/module_utils/vmware_rest.py b/module_utils/vmware_rest.py
index 515c138..b1bc03d 100644
--- a/module_utils/vmware_rest.py
+++ b/module_utils/vmware_rest.py
@@ -51,7 +51,11 @@ async def open_session(
if validate_certs:
connector = aiohttp.TCPConnector(limit=20)
else:
- connector = aiohttp.TCPConnector(limit=20, ssl=False)
+ ssl = importlib.import_module("ssl")
+ ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
+ ssl_context.verify_mode = ssl.CERT_NONE
+ ssl_context.check_hostname = False
+ connector = aiohttp.TCPConnector(limit=20, ssl=ssl_context)
async with aiohttp.ClientSession(
connector=connector, connector_owner=False, trace_configs=trace_configs
) as session: |
@goneri I'm still receiving the error. If you'd like, we can organize some time to do some screen sharing or IRC talk to troubleshoot. |
@kbreit Sure, good idea. You can ping me on #ansible-vmware anytime. |
@kbreit can you try this change instead: diff --git a/plugins/module_utils/vmware_rest.py b/plugins/module_utils/vmware_rest.py
index 515c138..ba88f47 100644
--- a/plugins/module_utils/vmware_rest.py
+++ b/plugins/module_utils/vmware_rest.py
@@ -48,10 +48,17 @@ async def open_session(
trace_configs = []
auth = aiohttp.BasicAuth(vcenter_username, vcenter_password)
- if validate_certs:
- connector = aiohttp.TCPConnector(limit=20)
- else:
- connector = aiohttp.TCPConnector(limit=20, ssl=False)
+ ssl = importlib.import_module("ssl")
+ ssl_context = ssl.create_default_context()
+ try:
+ certifi = importlib.import_module("certifi")
+ ssl_context.load_verify_locations(certifi.where())
+ except ModuleNotFoundError:
+ pass
+ if validate_certs is False:
+ ssl_context.check_hostname = False
+ ssl_context.verify_mode = ssl.CERT_NONE
+ connector = aiohttp.TCPConnector(limit=20, ssl=ssl_context)
async with aiohttp.ClientSession(
connector=connector, connector_owner=False, trace_configs=trace_configs
) as session: |
Unfortunately the same error. |
A parameter with a `False` value can be a legit parameter that we want to pass to the module. See: ansible-collections/vmware.vmware_rest#154
I managed to reproduce the problem. Can you try with this extra fix https://github.com/ansible-collections/cloud.common/pull/20/files The file to modify is here on your system: ~/.ansible/collections/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py |
@goneri @kbreit I tested ansible-collections/cloud.common#20 on macOS and works for me. |
Ok, great. This was the main problem. |
A parameter with a `False` value can be a legit parameter that we want to pass to the module. See: ansible-collections/vmware.vmware_rest#154
I close the issue since the problem has been addressed. |
SUMMARY
I am having problems where the
vmware_rest
modules won't run on my system. It works on someone else's system and I'd have to test it on another machine of mine.ISSUE TYPE
COMPONENT NAME
vcenter_vm_info
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
macOS 10.15, latest
STEPS TO REPRODUCE
EXPECTED RESULTS
It should work and return output
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: