trailofbits / algo

Set up a personal VPN in the cloud
https://blog.trailofbits.com/2016/12/12/meet-algo-the-vpn-that-works/
GNU Affero General Public License v3.0
28.98k stars 2.32k forks source link

Vultr Region Request Status -1 #14119

Closed Brandin closed 3 years ago

Brandin commented 3 years ago

Describe the bug

I am receiving the following error for Vultr despite being able to access the API in my browser without issue:

fatal: [localhost]: FAILED! => {"changed": false, "content": "", "elapsed": 10, "msg": "Status code was -1 and not [200]: Request failed: <urlopen error [Errno -3] Temporary failure in name resolution>", "redirected": false, "status": -1, "url": "https://api.vultr.com/v1/regions/list"}

To Reproduce

Steps to reproduce the behavior:

  1. Begin the algo script and select Vultr
  2. Continue through the steps, select your ini file and continue
  3. The error will be produced

Expected behavior

The setup would retrieve the regions properly, as we are able to access the API without issue in the browser

Full log

brandin@ACI-G1072:~/algo$ ./algo
[WARNING]: Could not match supplied host pattern, ignoring: vpn-host

PLAY [localhost] *************************************************************************************************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]

TASK [Playbook dir stat] *****************************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]

TASK [Ensure Ansible is not being run in a world writable directory] *********************************************************************************************************************************************************************************************************************************************************ok: [localhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [Ensure the requirements installed] *************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]

TASK [Set required ansible version as a fact] ********************************************************************************************************************************************************************************************************************************************************************************ok: [localhost] => (item=ansible==2.9.7)

TASK [Verify Python meets Algo VPN requirements] *****************************************************************************************************************************************************************************************************************************************************************************ok: [localhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [Verify Ansible meets Algo VPN requirements] ****************************************************************************************************************************************************************************************************************************************************************************ok: [localhost] => {
    "changed": false,
    "msg": "All assertions passed"
}
[WARNING]: Found variable using reserved name: no_log

PLAY [Ask user for the input] ************************************************************************************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]
[Cloud prompt]
What provider would you like to use?
    1. DigitalOcean
    2. Amazon Lightsail
    3. Amazon EC2
    4. Microsoft Azure
    5. Google Compute Engine
    6. Hetzner Cloud
    7. Vultr
    8. Scaleway
    9. OpenStack (DreamCompute optimised)
    10. CloudStack (Exoscale optimised)
    11. Linode
    12. Install to existing Ubuntu 18.04 or 20.04 server (for more advanced users)

Enter the number of your desired provider
:
7^M
TASK [Cloud prompt] **********************************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]

TASK [Set facts based on the input] ******************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]
[VPN server name prompt]
Name the vpn server
[algo]
:
bonobo^M
TASK [VPN server name prompt] ************************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]
[Cellular On Demand prompt]
Do you want macOS/iOS clients to enable "Connect On Demand" when connected to cellular networks?
[y/N]
:
Y^M
TASK [Cellular On Demand prompt] *********************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]
[Wi-Fi On Demand prompt]
Do you want macOS/iOS clients to enable "Connect On Demand" when connected to Wi-Fi?
[y/N]
:
Y^M
TASK [Wi-Fi On Demand prompt] ************************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]
[Trusted Wi-Fi networks prompt]
List the names of any trusted Wi-Fi networks where macOS/iOS clients should not use "Connect On Demand"
(e.g., your home network. Comma-separated value, e.g., HomeNet,OfficeWifi,AlgoWiFi)
:
^M
TASK [Trusted Wi-Fi networks prompt] *****************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]
[Retain the PKI prompt]
Do you want to retain the keys (PKI)? (required to add users in the future, but less secure)
[y/N]
:
N^M
TASK [Retain the PKI prompt] *************************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]
[DNS adblocking prompt]
Do you want to enable DNS ad blocking on this VPN server?
[y/N]
:
Y^M
TASK [DNS adblocking prompt] *************************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]
[SSH tunneling prompt]
Do you want each user to have their own account for SSH tunneling?
[y/N]
:
N^M
TASK [SSH tunneling prompt] **************************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]

TASK [Set facts based on the input] ******************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]

PLAY [Provision the server] **************************************************************************************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]

--> Please include the following block of text when reporting issues:

Algo running on: Ubuntu 18.04.5 LTS (Virtualized: microsoft)
Created from git fork. Last commit: 4adb35d Update README.md
Python 3.6.9
Runtime variables:
    algo_provider "vultr"
    algo_ondemand_cellular "True"
    algo_ondemand_wifi "True"
    algo_ondemand_wifi_exclude "X251bGw="
    algo_dns_adblocking "True"
    algo_ssh_tunneling "False"
    wireguard_enabled "True"
    dns_encryption "True"

TASK [Display the invocation environment] ************************************************************************************************************************************************************************************************************************************************************************************changed: [localhost -> localhost]

TASK [Install the requirements] **********************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost -> localhost]

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

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

TASK [Copy the private SSH key to /tmp] **************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost -> localhost]
[cloud-vultr : pause]
Enter the local path to your configuration INI file
(https://trailofbits.github.io/algo/cloud-vultr.html):
:
^M
TASK [cloud-vultr : pause] ***************************************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]

TASK [cloud-vultr : Set the token as a fact] *********************************************************************************************************************************************************************************************************************************************************************************ok: [localhost]

TASK [cloud-vultr : Get regions] *********************************************************************************************************************************************************************************************************************************************************************************************fatal: [localhost]: FAILED! => {"changed": false, "content": "", "elapsed": 10, "msg": "Status code was -1 and not [200]: Request failed: <urlopen error [Errno -3] Temporary failure in name resolution>", "redirected": false, "status": -1, "url": "https://api.vultr.com/v1/regions/list"}
included: /home/brandin/algo/playbooks/rescue.yml for localhost

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

TASK [Fail the installation] *************************************************************************************************************************************************************************************************************************************************************************************************fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}

PLAY RECAP *******************************************************************************************************************************************************************************************************************************************************************************************************************localhost                  : ok=28   changed=1    unreachable=0    failed=1    skipped=0    rescued=1    ignored=0
davidemyers commented 3 years ago

I can't reproduce this issue. I'm able to deploy to Vultr from Ubuntu 18.04.5.

Do you get what looks like a bunch of region information or an error message if you run the following from the same command line where you ran ./algo:

curl https://api.vultr.com/v1/regions/list
Brandin commented 3 years ago

Interestingly enough I get the same error I do in the algo installer...seems to be an issue with curl, I'll have to look into this more. Not an issue with your project, but have you ever seen this before?

EDIT: Fixed it on my own! I had to change my nameservers in /etc/resolv.conf as I'm on WSL and it was using my default nameservers for my existing VPN, but it should be using Google DNS

  1. sudo su - root
  2. nano /etc/resolv.conf
  3. Add these two lines:
    nameserver 8.8.8.8
    nameserver 8.8.4.4