algo icon indicating copy to clipboard operation
algo copied to clipboard

Failed to validate the SSL certificate for api.digitalocean.com:443.

Open jwebbstevens opened this issue 8 years ago • 7 comments

OS / Environment

MacOS 10.13.3

Ansible version

ansible 2.2.1

Summary of the problem

Doesn't deploy VPN, tried all regions in DigitalOcean.

Steps to reproduce the behavior

    1. DigitalOcean
    2. Amazon EC2
    3. Microsoft Azure
    4. Google Compute Engine
    5. Install to existing Ubuntu 16.04 server

Enter the number of your desired provider
: 1

Enter your API token. The token must have read and write permissions (https://cloud.digitalocean.com/settings/api/tokens):
[pasted values will not be displayed]
: 

Name the vpn server:
[algo.local]: vpnserver


What region should the server be located in?
    1.  Amsterdam        (Datacenter 2)
    2.  Amsterdam        (Datacenter 3)
    3.  Frankfurt
    4.  London
    5.  New York         (Datacenter 1)
    6.  New York         (Datacenter 2)
    7.  New York         (Datacenter 3)
    8.  San Francisco    (Datacenter 1)
    9.  San Francisco    (Datacenter 2)
    10. Singapore
    11. Toronto
    12. Bangalore
Enter the number of your desired region:
[7]: 4

Do you want macOS/iOS clients to enable "VPN On Demand" when connected to cellular networks?
[y/N]: y

Do you want macOS/iOS clients to enable "VPN On Demand" when connected to Wi-Fi?
[y/N]: y

List the names of trusted Wi-Fi networks (if any) that macOS/iOS clients exclude from using the VPN (e.g., your home network. Comma-separated value, e.g., HomeNet,OfficeWifi,AlgoWiFi)
: 

Do you want to install a DNS resolver on this VPN server, to block ads while surfing?
[y/N]: y

Do you want each user to have their own account for SSH tunneling?
[y/N]: y

Do you want to apply operating system security enhancements on the server? (warning: replaces your sshd_config)
[y/N]: y

Do you want the VPN to support Windows 10 or Linux Desktop clients? (enables compatible ciphers and key exchange, less secure)
[y/N]: N

Do you want to retain the CA key? (required to add users in the future, but less secure)
[y/N]: N```

### The way of deployment (cloud or local)

`Ansible run locally. Deployed to DigitalOcean any region.`

### Expected behavior

`Expect the VPN to spin up`

### Actual behavior

```TASK [cloud-digitalocean : Tag the droplet] ************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to validate the SSL certificate for api.digitalocean.com:443. Make sure your managed systems have a valid CA certificate installed. You can use validate_certs=False if you do not need to confirm the servers identity but this is unsafe and not recommended. Paths checked for this platform: /etc/ssl/certs, /etc/ansible, /usr/local/etc/openssl"}```


### Full log

```<PLAY [Configure the server] ****************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [Generate the SSH private key] ********************************************
ok: [localhost]

TASK [Generate the SSH public key] *********************************************
ok: [localhost]

TASK [Change mode for the SSH private key] *************************************
ok: [localhost]

TASK [Ensure the dynamic inventory exists] *************************************
ok: [localhost]

TASK [cloud-digitalocean : Set the DigitalOcean Access Token fact] *************
ok: [localhost]

TASK [cloud-digitalocean : Delete the existing Algo SSH keys] ******************
FAILED - RETRYING: TASK: cloud-digitalocean : Delete the existing Algo SSH keys (10 retries left).
ok: [localhost]

TASK [cloud-digitalocean : Upload the SSH key] *********************************
changed: [localhost]

TASK [cloud-digitalocean : Creating a droplet...] ******************************
ok: [localhost]

TASK [cloud-digitalocean : Add the droplet to an inventory group] **************
changed: [localhost]

TASK [cloud-digitalocean : set_fact] *******************************************
ok: [localhost]

TASK [cloud-digitalocean : Tag the droplet] ************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to validate the SSL certificate for api.digitalocean.com:443. Make sure your managed systems have a valid CA certificate installed. You can use validate_certs=False if you do not need to confirm the servers identity but this is unsafe and not recommended. Paths checked for this platform: /etc/ssl/certs, /etc/ansible, /usr/local/etc/openssl"}

TASK [cloud-digitalocean : debug] **********************************************
ok: [localhost] => {
    "fail_hint": [
        "Sorry, but something went wrong!", 
        "Please check the troubleshooting guide.", 
        "https://trailofbits.github.io/algo/troubleshooting.html"
    ]
}

TASK [cloud-digitalocean : fail] ***********************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failed as requested from task"}

PLAY RECAP *********************************************************************
localhost                  : ok=12   changed=2    unreachable=0    failed=1>```

jwebbstevens avatar Feb 11 '18 02:02 jwebbstevens

Looks like you’re doing this from a network that is terminating and re-encrypting TLS or a captive portal. Try from a different network.

dguido avatar Feb 11 '18 15:02 dguido

Thanks. I'll give that a shot.

jwebbstevens avatar Feb 11 '18 16:02 jwebbstevens

I tried this and got the following error again (same as above).

This time I switched the network default that VerizonFIOS provides with its box (default passwords obv changed). So this means instead of going through my wifi router my local machine (my MacOS) is connecting to the ISP directly through their box.

No fancy settings on VerizonFIOS just the normal stuff. Is VerizonFIOS shutting this down potentially? I know they are rather anti VPN.

fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to validate the SSL certificate for api.digitalocean.com:443. Make sure your managed systems have a valid CA certificate installed. You can use validate_certs=False if you do not need to confirm the servers identity but this is unsafe and not recommended. Paths checked for this platform: /etc/ssl/certs, /etc/ansible, /usr/local/etc/openssl"}

TASK [cloud-digitalocean : debug] **********************************************
ok: [localhost] => {
    "fail_hint": [
        "Sorry, but something went wrong!", 
        "Please check the troubleshooting guide.", 
        "https://trailofbits.github.io/algo/troubleshooting.html"
    ]
}

TASK [cloud-digitalocean : fail] ***********************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failed as requested from task"}

PLAY RECAP *********************************************************************
localhost                  : ok=12   changed=2    unreachable=0    failed=1   ```

jwebbstevens avatar Feb 11 '18 18:02 jwebbstevens

NVM. Figured it out. Ran the service on a different network not running on VerizionFIOS and double checked the dependencies. Took a while to spin up (Digital Ocean issue I think), but it works now.

jwebbstevens avatar Feb 12 '18 15:02 jwebbstevens

I've hit this same problem and I've tried regular wifi connection and through mobile Hotspot, same error. Will keep looking for solutions.

MDJCM avatar Sep 19 '18 18:09 MDJCM

I was advised to run ./algo -vvv which resulted in this output:

TASK [cloud-digitalocean : Get regions] ***************************************************************************
task path: /Users/marcos/Downloads/algo-master/roles/cloud-digitalocean/tasks/prompts.yml:15
The full traceback is:
  File "/var/folders/_s/gq5vnsh17zd7dzq11_wf0j000000gn/T/ansible_4XVYqA/ansible_modlib.zip/ansible/module_utils/urls.py", line 1017, in fetch_url
    client_key=client_key, cookies=cookies)
  File "/var/folders/_s/gq5vnsh17zd7dzq11_wf0j000000gn/T/ansible_4XVYqA/ansible_modlib.zip/ansible/module_utils/urls.py", line 920, in open_url
    r = urllib_request.urlopen(*urlopen_args)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 427, in open
    req = meth(req)
  File "/var/folders/_s/gq5vnsh17zd7dzq11_wf0j000000gn/T/ansible_4XVYqA/ansible_modlib.zip/ansible/module_utils/urls.py", line 736, in http_request
    build_ssl_validation_error(self.hostname, self.port, paths_checked, e)
  File "/var/folders/_s/gq5vnsh17zd7dzq11_wf0j000000gn/T/ansible_4XVYqA/ansible_modlib.zip/ansible/module_utils/urls.py", line 542, in build_ssl_validation_error
    raise SSLValidationError(' '.join(msg) % (hostname, port, ", ".join(paths)))

fatal: [localhost]: FAILED! => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "attributes": null, 
            "backup": null, 
            "body": null, 
            "body_format": "raw", 
            "client_cert": null, 
            "client_key": null, 
            "content": null, 
            "creates": null, 
            "delimiter": null, 
            "dest": null, 
            "directory_mode": null, 
            "follow": false, 
            "follow_redirects": "safe", 
            "force": false, 
            "force_basic_auth": false, 
            "group": null, 
            "headers": {
                "Authorization": "Bearer REMOVED", 
                "Content-Type": "application/json"
            }, 
            "http_agent": "ansible-httpget", 
            "method": "GET", 
            "mode": null, 
            "owner": null, 
            "regexp": null, 
            "remote_src": null, 
            "removes": null, 
            "return_content": false, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": null, 
            "status_code": [
                "200"
            ], 
            "timeout": 30, 
            "unsafe_writes": null, 
            "url": "https://api.digitalocean.com/v2/regions", 
            "url_password": null, 
            "url_username": null, 
            "use_proxy": true, 
            "validate_certs": true
        }
    }, 
    "msg": "Failed to validate the SSL certificate for api.digitalocean.com:443. Make sure your managed systems have a valid CA certificate installed. You can use validate_certs=False if you do not need to confirm the servers identity but this is unsafe and not recommended. Paths checked for this platform: /etc/ssl/certs, /etc/ansible, /usr/local/etc/openssl. The exception msg was: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)."
}
Read vars_file 'config.cfg'

TASK [cloud-digitalocean : debug] *********************************************************************************
task path: /Users/marcos/Downloads/algo-master/roles/cloud-digitalocean/tasks/main.yml:101
ok: [localhost] => {
    "fail_hint": [
        "Sorry, but something went wrong!", 
        "Please check the troubleshooting guide.", 
        "https://trailofbits.github.io/algo/troubleshooting.html"
    ]
}
Read vars_file 'config.cfg'

TASK [cloud-digitalocean : fail] **********************************************************************************
task path: /Users/marcos/Downloads/algo-master/roles/cloud-digitalocean/tasks/main.yml:103
fatal: [localhost]: FAILED! => {
    "changed": false, 
    "msg": "Failed as requested from task"
}

MDJCM avatar Sep 20 '18 08:09 MDJCM

Actually the same error message was described in #114 and #206. No real answers in either of those reports either.

TC1977 avatar Sep 20 '18 15:09 TC1977