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.65k stars 2.31k forks source link

Missing GCE connection parameters in libcloud secrets file #274

Closed solaris7x closed 7 years ago

solaris7x commented 7 years ago

OS / Environment

Ubuntu 16.04.2

Ansible version

ansible 2.2.0.0 config file = /root/algo-master/ansible.cfg configured module search path = Default w/o overrides

Version of components from requirements.txt

adal (0.4.5) ansible (2.2.0.0) apache-libcloud (1.5.0) appdirs (1.4.3) asn1crypto (0.22.0) azure (2.0.0rc5) azure-batch (0.30.0rc5) azure-common (1.1.4) azure-graphrbac (0.30.0rc5) azure-mgmt (0.30.0rc5) azure-mgmt-authorization (0.30.0rc5) azure-mgmt-batch (0.30.0rc5) azure-mgmt-cdn (0.30.0rc5) azure-mgmt-cognitiveservices (0.30.0rc5) azure-mgmt-commerce (0.30.0rc5) azure-mgmt-compute (0.30.0rc5) azure-mgmt-keyvault (0.30.0rc5) azure-mgmt-logic (0.30.0rc5) azure-mgmt-network (0.30.0rc5) azure-mgmt-notificationhubs (0.30.0rc5) azure-mgmt-nspkg (1.0.0) azure-mgmt-powerbiembedded (0.30.0rc5) azure-mgmt-redis (0.30.0rc5) azure-mgmt-resource (0.30.0rc5) azure-mgmt-scheduler (0.30.0rc5) azure-mgmt-storage (0.30.0rc5) azure-mgmt-web (0.30.0rc5) azure-nspkg (1.0.0) azure-servicebus (0.20.2) azure-servicemanagement-legacy (0.20.3) azure-storage (0.32.0) boto (2.46.1) boto3 (1.4.4) botocore (1.5.26) certifi (2017.1.23) cffi (1.9.1) chardet (2.3.0) cryptography (1.8.1) docutils (0.13.1) dopy (0.3.5) enum34 (1.1.6) futures (3.0.5) idna (2.5) ipaddress (1.0.18) isodate (0.5.4) Jinja2 (2.8) jmespath (0.9.2) keyring (10.3) MarkupSafe (1.0) msrest (0.4.1) msrestazure (0.4.7) oauthlib (2.0.1) packaging (16.8) paramiko (2.1.2) pip (9.0.1) pkg-resources (0.0.0) pyasn1 (0.2.3) pycparser (2.17) pycrypto (2.6.1) PyJWT (1.4.2) pyOpenSSL (16.2.0) pyparsing (2.2.0) python-dateutil (2.6.0) PyYAML (3.12) requests (2.13.0) requests-oauthlib (0.8.0) s3transfer (0.1.10) SecretStorage (2.3.1) setuptools (34.3.2) six (1.10.0) wheel (0.30.0a0)

Summary of the problem

Unable to deploy remotely on Google cloud

Steps to reproduce the behavior

(env) root@ubuntu-512mb-blr1-01:~/algo-master# ./algo

What provider would you like to use?

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

Enter the number of your desired provider : 3

Enter the local path to your credentials JSON file (https://support.google.com/cloud/answer/6158849?hl=en&ref_topic=6262490#serviceaccounts): : /root/vpn.json

Name the vpn server:

What zone should the server be located in?

  1. Central US (Iowa A)
  2. Central US (Iowa B)
  3. Central US (Iowa C)
  4. Central US (Iowa F)
  5. Eastern US (South Carolina B)
  6. Eastern US (South Carolina C)
  7. Eastern US (South Carolina D)
  8. Western Europe (Belgium B)
  9. Western Europe (Belgium C)
  10. Western Europe (Belgium D)
  11. East Asia (Taiwan A)
  12. East Asia (Taiwan B)
  13. East Asia (Taiwan C) Please choose the number of your zone. Press enter for default (#8) zone.

Do you want to enable VPN On Demand when connected to cellular networks? y/N:

Do you want to enable VPN On Demand when connected to Wi-Fi? y/N:

Do you want to install a local DNS resolver to block ads while surfing?

Do you want each user to have their own account for SSH tunneling?

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

Do you want the VPN to support Windows 10 clients? (requires RSA certificates and key exchange, less secure) y/N:

Do you want to store the CA key? (required for update-users script, but less secure) y/N:

PLAY [Configure the server] ****

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

TASK [Generate the SSH private key] **** changed: [localhost -> localhost]

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

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

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

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

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

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

TASK [cloud-gce : Creating a new instance...] ** fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Missing GCE connection parameters in libcloud secrets file."}

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

(env) root@ubuntu-512mb-blr1-01:~/algo-master#

The way of deployment (cloud or local)

Cloud

Expected behavior

Create vm and successfully deploy Algo

Actual behavior

Error : Missing GCE connection parameters in libcloud secrets file.

Full log

jackivanov commented 7 years ago

@Guilty-King Can not reproduce, works well for me. How your credential file looks like? Put it here (you can delete all secret lines)

solaris7x commented 7 years ago

@gunph1ld Here I copied the the contents of file and edited secret keys

{"installed":{"client_id":"169276586288-mevddlvkhkv10gs1loael5bjv7hj6nc2.apps.googleusercontent.com","project_id":"reflected-coder-161920","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://accounts.google.com/o/oauth2/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"kzMwop1YmPz6_JRYTKDoqZM-","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}

jackivanov commented 7 years ago

@Guilty-King Seems you file is broken, try to create another one. I should looks like this one:

{
  "type": "service_account",
  "project_id": "algo-123",
  "private_key_id": "5751be4f****4",
  "private_key": "KEYHERE",
  "client_email": "blabla@developer.gserviceaccount.com",
  "client_id": "104****180425",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://accounts.google.com/o/oauth2/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/blabla"
}

Use this FAQ. It's quite clear how to get this file there