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

Windows setup fails unless you install Six first #290

Closed joshmeisels closed 7 years ago

joshmeisels commented 7 years ago

OS / Environment

Windows 10

Ansible version

2.2.0.0

Summary of the problem

After completing the Windows instructions, if you attempt step 4 of the README as instructed, it fails with an error about six.moves not found.

~Problem can be resolved by installing Six using pip install six before running step 4 of the README.~ [EDIT] Six needs to be installed within the virtual environment, so this isn't quite right. I was able to resolve it with this change, and it may be possible to fix it with a change to the requirements.txt file. python -m virtualenv env && source env/bin/activate && python -m pip install six packaging appdirs && python -m pip install -r requirements.txt

[EDIT2] I also hit an error about msrestazure missing later in the process. Seems that you also need to install msrestazure. To do this, I found I first needed to update pip using pip install -U pip and then I could run pip install msrestazure. It fails if you don't update pip first.

Steps to reproduce the behavior

Follow Windows instructions, then run pip install virtualenv && virtualenv env && source env/bin/activate && pip install -r requirements.txt as listed in Step 4 of the readme.

The way of deployment (cloud or local)

Irrelevant, but goal was an Azure deployment.

Expected behavior

Step 4 should complete without error.

Actual behavior

Error returned due to Six not being installed by default in the Windows 10 Ubuntu subsystem.

dmwyatt commented 7 years ago

The proposed solution does not work for me. I assume this is because the error happening within the virtualenv and running pip install six prior to Step 4 installs six in the root python environment.

I had to add six, packaging, pyparsing, and appdirs to the top of requirements.txt and remove six from further down in the file.

It feels like some package algo depends on does not have the correct configuration to pull in its required dependencies, but I don't know what is actually going on.

If what I did ends up being the actual fix used, you'll likely want to pin the versions of those packages rather than just using the raw package name.

JimboSchneider commented 7 years ago

Even having updated the requirements.txt like you stated, I'm still seeing errors trying to run step 4. I'm not sure if mine are related or not.

image

dmwyatt commented 7 years ago

@JimboSchneider Your issue is probably not related. There at the end it shows a permission denied error. Somewhere along the line you might of used sudo where you shouldn't have?

JimboSchneider commented 7 years ago

Thank you @dmwyatt I'm sure it's a me issue. :)

tpmehta commented 7 years ago

Hello @dmwyatt - I experienced the same six issue, and followed your steps above (i.e. modify requirements.txt), and then ran step 4. Seem to hit an issue on cleanup of setuptools:

Installing collected packages: setuptools, ansible, dopy, boto, boto3, azure, msrest, apache-libcloud, pyopenssl, jinja2 , paramiko, PyYAML, pycrypto, requests, botocore, jmespath, s3transfer, azure-mgmt, azure-servicebus, azure-graphrbac, a zure-storage, azure-servicemanagement-legacy, azure-batch, requests-oauthlib, keyring, chardet, enum34, certifi, isodate , cryptography, MarkupSafe, pyasn1, docutils, python-dateutil, futures, azure-mgmt-logic, azure-mgmt-powerbiembedded, az ure-mgmt-commerce, azure-mgmt-web, azure-mgmt-storage, azure-mgmt-authorization, azure-mgmt-network, azure-mgmt-compute, azure-mgmt-batch, azure-mgmt-notificationhubs, azure-mgmt-resource, azure-mgmt-cognitiveservices, azure-mgmt-redis, azu re-mgmt-scheduler, azure-mgmt-cdn, azure-mgmt-keyvault, azure-common, azure-nspkg, oauthlib, secretstorage, idna, asn1cr ypto, ipaddress, cffi, azure-mgmt-nspkg, pycparser Found existing installation: setuptools 2.2 Uninstalling setuptools: Successfully uninstalled setuptools Rolling back uninstall of setuptools Cleaning up... Exception: Traceback (most recent call last): File "/home/tmehta/algo/env/local/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main status = self.run(options, args) File "/home/tmehta/algo/env/local/lib/python2.7/site-packages/pip/commands/install.py", line 283, in run requirement_set.install(install_options, global_options, root=options.root_path) File "/home/tmehta/algo/env/local/lib/python2.7/site-packages/pip/req.py", line 1435, in install requirement.install(install_options, global_options, *args, **kwargs) File "/home/tmehta/algo/env/local/lib/python2.7/site-packages/pip/req.py", line 671, in install self.move_wheel_files(self.source_dir, root=root) File "/home/tmehta/algo/env/local/lib/python2.7/site-packages/pip/req.py", line 901, in move_wheel_files pycompile=self.pycompile, File "/home/tmehta/algo/env/local/lib/python2.7/site-packages/pip/wheel.py", line 140, in move_wheel_files scheme = distutils_scheme(name, user=user, home=home, root=root) File "/home/tmehta/algo/env/local/lib/python2.7/site-packages/pip/locations.py", line 148, in distutils_scheme i = d.get_command_obj('install', create=True) File "/usr/lib/python2.7/distutils/dist.py", line 845, in get_command_obj klass = self.get_command_class(command) File "/home/tmehta/algo/env/local/lib/python2.7/site-packages/setuptools/dist.py", line 364, in get_command_class self.cmdclass[command] = cmdclass = ep.load() File "/home/tmehta/algo/env/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2302, in load return self.resolve() File "/home/tmehta/algo/env/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2308, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) ImportError: No module named command.install

Any ideas why I am getting stuck here?

tpmehta commented 7 years ago

I just tried to remove setuptools from the requirements.txt file, and then re-ran. Seemed to run to completion successfully. I then ran algo, and encountered the following error. It appears a couple of others have hit this as well: TASK [cloud-azure : Create a resource group] *********************************** fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Do you have azure==2.0.0rc5 installed? Trypi p install azure==2.0.0rc5- No module named msrestazure.azure_exceptions"}

joshmeisels commented 7 years ago

@tpmehta I hit an exception about msrestazure as well. You need to install msrestazure. In my experience, I had to first run pip install -U pip to update pip, and then run pip install msrestazure.

xtrapwr commented 7 years ago

I can confirm I had to follow both edit instructions in the original summary to successfully complete the pre-req installation. It's a valid work around at least.

tpmehta commented 7 years ago

Thanks @joshmeisels! I was able to get past the msrestazure step... but now am failing at the TASK [Check the system] step, with a similar failure to what you had posted in slack: `TASK [Copy the algo ssh key to the local ssh directory] **** ok: [localhost -> localhost]

TASK [Configure the local ssh config] ** changed: [localhost -> localhost]

PLAY [Configure the server and install required software] **

TASK [Check the system] **** fatal: [52.183.81.42]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Bad owner or pe rmissions on /home/tmehta/.ssh/config\r\n", "unreachable": true}

PLAY RECAP ***** 52.183.81.42 : ok=0 changed=0 unreachable=1 failed=0 localhost : ok=22 changed=9 unreachable=0 failed=0`

Were you able to resolve? Seems like an ssh connection issue (it's complaining about permissions). Is there a way to pick up the script from point of failure?

joshmeisels commented 7 years ago

@tpmehta see https://github.com/trailofbits/algo/issues/321. You just need to run chmod 664 ~/.ssh/config to change permissions. Then you can re-run ./algo and choose the option to set up on an existing VM (the one that was just created when you first ran Algo).

tpmehta commented 7 years ago

Thanks @joshmeisels - that was my bad for not looking at the troubleshooting steps... Though I wonder why my SSH config was flawed in the same way as yours.

xtrapwr commented 7 years ago

Of note, after I had my initial failure, I rooted myself before attempting the second run through. Don't know if that would affect future attempts for people installing via Windows who use proper user roles.

(I was frustrated, never root while frustrated)

anugrahsinghal commented 7 years ago

where and how do i have to create the ~/.azure/credentials file by manual input i get the error PLAY [Configure the server] ****

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

TASK [Generate the SSH private key] **** ok: [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] ***** ok: [localhost]

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

TASK [cloud-azure : Create a resource group] *** fatal: [localhost]: FAILED! => {“changed”: false, “failed”: true, “msg”: “Error checking for existence of name Algo_canadacentral – 403 Client Error: Forbidden for url: https://management.azure.com/subscriptions/********/resourcegroups/Algo_canadacentral?api-version=2016-02-01“}

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

tuangd commented 7 years ago

I had the same problem then I have to go through these steps to make it work.

hope this helps other people.

RyStar commented 7 years ago

Thanks for taking the time to contribute. Helped me.

dguido commented 7 years ago

We've gone through so many changes lately that I think this is no longer an issue. Win10 Creators Update in particular massively upgrades the WSL services. I think this issue is out of date.