algo icon indicating copy to clipboard operation
algo copied to clipboard

Malformed AWS auth header

Open flyinggrizzly opened this issue 8 years ago • 28 comments

Describe the bug

Unable to provision server on EC2, the DescribeRegions request is sent with malformed auth headers.

To Reproduce

Steps to reproduce the behavior:

  1. Clone Algo
  2. Create AWS account, IAM user using Algo's suggested policy
  3. Run algo, choosing EC2
  4. Proceed through setup prompts accepting defaults
  5. Provide IAM access ID 6 Provide IAM secret key

Expected behavior

Expect the script to continue and request the user to choose an AWS region

Full log

[cloud-ec2 : pause]
Enter your aws_access_key (http://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html)
Note: Make sure to use an IAM user with an acceptable policy attached (see https://github.com/trailofbits/algo/blob/master/docs/deploy-from-ansible.md)
 (output is hidden):

TASK [cloud-ec2 : pause] ***************************************************************************************************************************************************************************************
ok: [localhost]
[cloud-ec2 : pause]
Enter your aws_secret_key (http://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html)
 (output is hidden):

TASK [cloud-ec2 : pause] ***************************************************************************************************************************************************************************************
ok: [localhost]

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

TASK [cloud-ec2 : Get regions] *********************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ClientError: An error occurred (AuthFailure) when calling the DescribeRegions operation: Authorization header or parameters are not formatted correctly.
fatal: [localhost]: FAILED! => {"changed": false, "error": {"code": "AuthFailure", "message": "Authorization header or parameters are not formatted correctly."}, "msg": "Unable to describe regions: An error occurred (AuthFailure) when calling the DescribeRegions operation: Authorization header or parameters are not formatted correctly.", "response_metadata": {"http_headers": {"date": "Fri, 09 Nov 2018 20:59:09 GMT", "server": "AmazonEC2", "transfer-encoding": "chunked"}, "http_status_code": 401, "request_id": "85d8077d-a504-4cb8-a4db-f2e06168116b", "retry_attempts": 0}}

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

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

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

flyinggrizzly avatar Nov 09 '18 21:11 flyinggrizzly

Can you post the part of the log that shows the requested info? The part that comes after: --> Please include the following block of text when submitting issues:

TC1977 avatar Nov 10 '18 01:11 TC1977

Yea, sorry. Here's the full run output:


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

TASK [Gathering Facts] *****************************************************************************************************************************************************************************************
ok: [localhost]
[pause]
What provider would you like to use?
1. DigitalOcean
2. Amazon Lightsail
3. Amazon EC2
4. Vultr
5. Microsoft Azure
6. Google Compute Engine
  7. Scaleway
  8. OpenStack (DreamCompute optimised)
9. Install to existing Ubuntu 18.04 server (Advanced)

  Enter the number of your desired provider
  :
  3

  TASK [pause] ***************************************************************************************************************************************************************************************************
  ok: [localhost]

  TASK [Set facts based on the input] ****************************************************************************************************************************************************************************
  ok: [localhost]
  [pause]
  Name the vpn server
  [algo]
  :


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


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


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


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


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


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


  TASK [pause] ***************************************************************************************************************************************************************************************************
  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: Mac OS X 10.13.6
  Created from git fork. Last commit: a53dec6 Closes #1189
  Python 2.7.15
  Runtime variables:
  algo_provider "ec2"
  algo_ondemand_cellular "False"
  algo_ondemand_wifi "False"
  algo_ondemand_wifi_exclude "_null"
  algo_local_dns "False"
  algo_ssh_tunneling "False"
  algo_windows "False"
  wireguard_enabled "True"
  dns_encryption "True"

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

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

  TASK [Generate the SSH public key] *****************************************************************************************************************************************************************************
  changed: [localhost]
  [cloud-ec2 : pause]
  Enter your aws_access_key (http://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html)
  Note: Make sure to use an IAM user with an acceptable policy attached (see https://github.com/trailofbits/algo/blob/master/docs/deploy-from-ansible.md)
  (output is hidden):

    TASK [cloud-ec2 : pause] ***************************************************************************************************************************************************************************************
    ok: [localhost]
    [cloud-ec2 : pause]
    Enter your aws_secret_key (http://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html)
    (output is hidden):

      TASK [cloud-ec2 : pause] ***************************************************************************************************************************************************************************************
      ok: [localhost]

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

      TASK [cloud-ec2 : Get regions] *********************************************************************************************************************************************************************************
      An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ClientError: An error occurred (AuthFailure) when calling the DescribeRegions operation: Authorization header or parameters are not formatted correctly.
      fatal: [localhost]: FAILED! => {"changed": false, "error": {"code": "AuthFailure", "message": "Authorization header or parameters are not formatted correctly."}, "msg": "Unable to describe regions: An error occurred (AuthFailure) when calling the DescribeRegions operation: Authorization header or parameters are not formatted correctly.", "response_metadata": {"http_headers": {"date": "Sat, 10 Nov 2018 07:38:34 GMT", "server": "AmazonEC2", "transfer-encoding": "chunked"}, "http_status_code": 401, "request_id": "3a417006-f123-4dfc-acc5-64a7212d8ae5", "retry_attempts": 0}}

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

        ]

      }

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

PLAY RECAP *****************************************************************************************************************************************************************************************************
localhost                  : ok=19   changed=3    unreachable=0    failed=2



flyinggrizzly avatar Nov 10 '18 07:11 flyinggrizzly

Can't reproduce this. Try double-checking the minimum required policies, make sure they're correctly set on the Algo AWS user in IAM, and also make sure the security credentials are enabled.

TC1977 avatar Nov 10 '18 13:11 TC1977

Not sure what you mean by enabling the credentials sorry. The IAM user policy is the one you linked to though--it's been copy-pasted from these docs.

I'll have access to a different computer on Monday, so I'll try and eliminate local environment issues by trying a deploy then.

flyinggrizzly avatar Nov 10 '18 15:11 flyinggrizzly

Actually I think it's a copy-paste error. If the security credentials (the Access key ID and Secret access key) are disabled you get a different error. If so, it won't matter which computer you deploy from.

Log into the AWS Console, pick "IAM" from the services drop-down menu in the top-left corner. Then go to "Policies" on the left-hand menu. Find the minimum required permissions policy that you created. (It might help to filter policies by "customer-managed".) In the permissions tab, go to "JSON", and verify that you actually copy-pasted everything from the minimum required policies JSON, including {} signs and spacing. Then go to the user you've created, and verify that the correct policy has been attached.

You could also try deploying using credentials from a user with the AdministratorAccess policy attached, but this is probably not such a good idea from an AWS security standpoint.

TC1977 avatar Nov 10 '18 16:11 TC1977

@flyinggrizzly Still having problems?

TC1977 avatar Nov 23 '18 20:11 TC1977

I am experiencing the same issue as @flyinggrizzly. I confirmed that my IAM user has the correct minimum required permissions as outlined in the docs (summary: list, write for EC2, list, read, write for CloudFormation).

petealbertson avatar Nov 26 '18 06:11 petealbertson

I'm in the middle of moving and haven't had the time to come back to this, sorry! I've set up an instance on DO in the meantime, so I've effectively sidestepped the issue.

I can come back around and look at this with more time come December when work breaks for Christmas if that's useful though.

flyinggrizzly avatar Nov 26 '18 08:11 flyinggrizzly

@petealbertson I just installed using the config @flyinggrizzly posted, cloud install onto AWS instance, with a brand new user using a brand new minimum permissions policy. I specifically copy-pasted the JSON from the "minimum required permissions" link. You also have to delete the stub policy that's already on the JSON, which reads:

{
    "Version": "2012-10-17",
    "Statement": []
}

Please try again with a fresh Algo download, and copy-paste the policy as I did, and lemme know if you still get the same problem. Thanks.

TC1977 avatar Nov 29 '18 01:11 TC1977

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PreDeployment",
            "Effect": "Allow",
            "Action": [
                "ec2:DescribeImages",
                "ec2:DescribeKeyPairs",
                "ec2:DescribeRegions",
                "ec2:ImportKeyPair"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Sid": "DeployCloudFormationStack",
            "Effect": "Allow",
            "Action": [
                "cloudformation:CreateStack",
                "cloudformation:UpdateStack",
                "cloudformation:DescribeStacks",
                "cloudformation:DescribeStackEvents",
                "cloudformation:ListStackResources"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Sid": "CloudFormationEC2Access",
            "Effect": "Allow",
            "Action": [
                "ec2:CreateInternetGateway",
                "ec2:DescribeVpcs",
                "ec2:CreateVpc",
                "ec2:DescribeInternetGateways",
                "ec2:ModifyVpcAttribute",
                "ec2:createTags",
                "ec2:CreateSubnet",
                "ec2:Associate*",
                "ec2:CreateRouteTable",
                "ec2:AttachInternetGateway",
                "ec2:DescribeRouteTables",
                "ec2:DescribeSubnets",
                "ec2:ModifySubnetAttribute",
                "ec2:CreateRoute",
                "ec2:CreateSecurityGroup",
                "ec2:DescribeSecurityGroups",
                "ec2:AuthorizeSecurityGroupIngress",
                "ec2:RunInstances",
                "ec2:DescribeInstances",
                "ec2:AllocateAddress",
                "ec2:DescribeAddresses"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

mrphree avatar Dec 17 '18 18:12 mrphree

Above is the policy I am having problems with that TC1977 asked me to post.

mrphree avatar Dec 17 '18 18:12 mrphree

(env) root@KII-235450:~/algo# ./algo

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

TASK [Gathering Facts] *************************************************************************************** ok: [localhost] [pause] What provider would you like to use? 1. DigitalOcean 2. Amazon Lightsail 3. Amazon EC2 4. Vultr 5. Microsoft Azure 6. Google Compute Engine 7. Scaleway 8. OpenStack (DreamCompute optimised) 9. Install to existing Ubuntu 18.04 server (Advanced)

Enter the number of your desired provider : 3

TASK [pause] ************************************************************************************************* ok: [localhost]

TASK [Set facts based on the input] ************************************************************************** ok: [localhost] [pause] Name the vpn server [algo] :

TASK [pause] ************************************************************************************************* ok: [localhost] [pause] Do you want macOS/iOS clients to enable "VPN On Demand" when connected to cellular networks? [y/N] : n

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

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

TASK [pause] ************************************************************************************************* ok: [localhost] [pause] Do you want each user to have their own account for SSH tunneling? [y/N] : n

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

TASK [pause] ************************************************************************************************* ok: [localhost] [pause] Do you want to retain the CA key? (required to add users in the future, but less secure) [y/N] : n

TASK [pause] ************************************************************************************************* 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.1 LTS Created from git fork. Last commit: a6cd895 Fixes #1246 Python 2.7.15rc1 Runtime variables: algo_provider "ec2" algo_ondemand_cellular "False" algo_ondemand_wifi "False" algo_ondemand_wifi_exclude "_null" algo_local_dns "False" algo_ssh_tunneling "False" algo_windows "True" 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 [cloud-ec2 : Install requirements] ********************************************************************** ok: [localhost] [cloud-ec2 : pause] Enter your aws_access_key (http://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html) Note: Make sure to use an IAM user with an acceptable policy attached (see https://github.com/trailofbits/algo/blob/master/docs/deploy-from-ansible.md) (output is hidden):

TASK [cloud-ec2 : pause] ************************************************************************************* ok: [localhost] [cloud-ec2 : pause] Enter your aws_secret_key (http://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html) (output is hidden):

TASK [cloud-ec2 : pause] ************************************************************************************* ok: [localhost]

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

TASK [cloud-ec2 : Get regions] ******************************************************************************* An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ClientError: An error occurred (AuthFailure) when calling the DescribeRegions operation: AWS was not able to validate the provided access credentials fatal: [localhost]: FAILED! => {"changed": false, "error": {"code": "AuthFailure", "message": "AWS was not able to validate the provided access credentials"}, "msg": "Unable to describe regions: An error occurred (AuthFailure) when calling the DescribeRegions operation: AWS was not able to validate the provided access credentials", "response_metadata": {"http_headers": {"date": "Mon, 17 Dec 2018 21:52:11 GMT", "server": "AmazonEC2", "transfer-encoding": "chunked"}, "http_status_code": 401, "request_id": "bce0df0f-ab70-4d3b-9baa-e11985c3f615", "retry_attempts": 0}}

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

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

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

mrphree avatar Dec 17 '18 21:12 mrphree

@mrphree, Thanks for posting that. Yes, the policy looks correct.

I really don't have a good idea what's wrong, since I've been installing without any problems on AWS for a while now. Do you want to try ./algo -vvv and post the output, please? (Be careful to redact your AWS access key and secret key, as they might print out in plain text.)

TC1977 avatar Dec 18 '18 21:12 TC1977

Sure, but before I do, clarify something for me. Should I have the admin policy AND the above pasted policy? or just the above pasted policy?

mrphree avatar Dec 18 '18 22:12 mrphree

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "*",
            "Resource": "*"
        }
    ]
}

mrphree avatar Dec 18 '18 22:12 mrphree

That is the admin policy I have.

mrphree avatar Dec 18 '18 22:12 mrphree

@mrphree It seems pretty dang complex to predict how AWS will act with conflicting user permissions. For debug purposes, run ./algo -vvv with only the minimum required permission policy attached, not the admin policy.

TC1977 avatar Dec 18 '18 23:12 TC1977

Ok, here is the output of running ./algo -vvv .

One thing that is surprising to me and catches my eye is: You are not subscribed to this service. Please go to http://aws.amazon.com to subscribe.

If I am not subscribed how am I generating keys and secret keys? Thanks for looking at this, let me know what you think:

`root@KII-235450:~/algo# ./algo -vvv ansible-playbook 2.5.2 config file = /root/algo/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /root/algo/env/local/lib/python2.7/site-packages/ansible executable location = /root/algo/env/bin/ansible-playbook python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0] Using /root/algo/ansible.cfg as config file Parsed /root/algo/inventory inventory source with ini plugin Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' statically imported: /root/algo/roles/cloud-digitalocean/tasks/venv.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/cloud-digitalocean/tasks/prompts.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/cloud-ec2/tasks/venv.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/cloud-ec2/tasks/prompts.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/cloud-ec2/tasks/encrypt_image.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/cloud-ec2/tasks/cloudformation.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/cloud-vultr/tasks/prompts.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/cloud-gce/tasks/venv.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/cloud-gce/tasks/prompts.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/cloud-azure/tasks/venv.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/cloud-azure/tasks/prompts.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/cloud-lightsail/tasks/venv.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/cloud-lightsail/tasks/prompts.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/cloud-scaleway/tasks/prompts.yml Read vars_file 'config.cfg' Read vars_file 'config.cfg' statically imported: /root/algo/roles/cloud-openstack/tasks/venv.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/local/tasks/prompts.yml Read vars_file 'config.cfg' statically imported: /root/algo/playbooks/cloud-post.yml Read vars_file 'config.cfg' statically imported: /root/algo/playbooks/cloud-pre.yml Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' statically imported: /root/algo/roles/common/tasks/facts.yml Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' statically imported: /root/algo/roles/wireguard/tasks/keys.yml Read vars_file 'config.cfg' Read vars_file 'config.cfg' statically imported: /root/algo/roles/vpn/tasks/ipsec_configuration.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/vpn/tasks/openssl.yml Read vars_file 'config.cfg' statically imported: /root/algo/roles/vpn/tasks/distribute_keys.yml Read vars_file 'config.cfg' Read vars_file 'config.cfg' statically imported: /root/algo/roles/vpn/tasks/client_configs.yml

PLAYBOOK: main.yml ************************************************************* 3 plays in main.yml Read vars_file 'config.cfg' Read vars_file 'config.cfg'

PLAY [Ask user for the input] ************************************************** Read vars_file 'config.cfg' Using module file /root/algo/env/local/lib/python2.7/site-packages/ansible/modules/system/setup.py ESTABLISH LOCAL CONNECTION FOR USER: root EXEC /bin/sh -c 'echo ~ && sleep 0' EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp/ansible-tmp-1545235794.9-81229669825727" && echo ansible-tmp-1545235794.9-81229669825727="echo /root/.ansible/tmp/ansible-tmp-1545235794.9-81229669825727" ) && sleep 0' PUT /root/.ansible/tmp/ansible-local-2702CpnHfo/tmpgWu48k TO /root/.ansible/tmp/ansible-tmp-1545235794.9-81229669825727/setup.py EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1545235794.9-81229669825727/ /root/.ansible/tmp/ansible-tmp-1545235794.9-81229669825727/setup.py && sleep 0' EXEC /bin/sh -c 'python /root/.ansible/tmp/ansible-tmp-1545235794.9-81229669825727/setup.py && sleep 0' EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1545235794.9-81229669825727/ > /dev/null 2>&1 && sleep 0'

TASK [Gathering Facts] ********************************************************* task path: /root/algo/input.yml:2 ok: [localhost] META: ran handlers Read vars_file 'config.cfg' [pause] What provider would you like to use? 1. DigitalOcean 2. Amazon Lightsail 3. Amazon EC2 4. Vultr 5. Microsoft Azure 6. Google Compute Engine 7. Scaleway 8. OpenStack (DreamCompute optimised) 9. Install to existing Ubuntu 18.04 server (Advanced)

Enter the number of your desired provider : 3

TASK [pause] ******************************************************************* task path: /root/algo/input.yml:28 ok: [localhost] => { "changed": false, "delta": 2, "echo": true, "rc": 0, "start": "2018-12-19 09:09:55.918159", "stderr": "", "stdout": "Paused for 0.04 minutes", "stop": "2018-12-19 09:09:58.255336", "user_input": "3" } Read vars_file 'config.cfg'

TASK [Set facts based on the input] ******************************************** task path: /root/algo/input.yml:39 ok: [localhost] => { "ansible_facts": { "algo_provider": "ec2" }, "changed": false } Read vars_file 'config.cfg' [pause] Name the vpn server [algo] :

TASK [pause] ******************************************************************* task path: /root/algo/input.yml:43 ok: [localhost] => { "changed": false, "delta": 1, "echo": true, "rc": 0, "start": "2018-12-19 09:09:58.436208", "stderr": "", "stdout": "Paused for 0.02 minutes", "stop": "2018-12-19 09:09:59.631225", "user_input": "" } Read vars_file 'config.cfg' [pause] Do you want macOS/iOS clients to enable "VPN On Demand" when connected to cellular networks? [y/N] :

TASK [pause] ******************************************************************* task path: /root/algo/input.yml:52 ok: [localhost] => { "changed": false, "delta": 0, "echo": true, "rc": 0, "start": "2018-12-19 09:09:59.719040", "stderr": "", "stdout": "Paused for 0.01 minutes", "stop": "2018-12-19 09:10:00.367139", "user_input": "" } Read vars_file 'config.cfg' [pause] Do you want macOS/iOS clients to enable "VPN On Demand" when connected to Wi-Fi? [y/N] :

TASK [pause] ******************************************************************* task path: /root/algo/input.yml:59 ok: [localhost] => { "changed": false, "delta": 0, "echo": true, "rc": 0, "start": "2018-12-19 09:10:00.451156", "stderr": "", "stdout": "Paused for 0.01 minutes", "stop": "2018-12-19 09:10:00.751159", "user_input": "" } Read vars_file 'config.cfg' Read vars_file 'config.cfg' [pause] Do you want to install a DNS resolver on this VPN server, to block ads while surfing? [y/N] :

TASK [pause] ******************************************************************* task path: /root/algo/input.yml:76 ok: [localhost] => { "changed": false, "delta": 0, "echo": true, "rc": 0, "start": "2018-12-19 09:10:00.872961", "stderr": "", "stdout": "Paused for 0.01 minutes", "stop": "2018-12-19 09:10:01.199005", "user_input": "" } Read vars_file 'config.cfg' [pause] Do you want each user to have their own account for SSH tunneling? [y/N] :

TASK [pause] ******************************************************************* task path: /root/algo/input.yml:83 ok: [localhost] => { "changed": false, "delta": 0, "echo": true, "rc": 0, "start": "2018-12-19 09:10:01.287218", "stderr": "", "stdout": "Paused for 0.01 minutes", "stop": "2018-12-19 09:10:01.663103", "user_input": "" } Read vars_file 'config.cfg' [pause] Do you want the VPN to support Windows 10 or Linux Desktop clients? (enables compatible ciphers and key exchange, less secure) [y/N] :

TASK [pause] ******************************************************************* task path: /root/algo/input.yml:90 ok: [localhost] => { "changed": false, "delta": 0, "echo": true, "rc": 0, "start": "2018-12-19 09:10:01.750832", "stderr": "", "stdout": "Paused for 0.01 minutes", "stop": "2018-12-19 09:10:02.111137", "user_input": "" } Read vars_file 'config.cfg' [pause] Do you want to retain the CA key? (required to add users in the future, but less secure) [y/N] :

TASK [pause] ******************************************************************* task path: /root/algo/input.yml:97 ok: [localhost] => { "changed": false, "delta": 0, "echo": true, "rc": 0, "start": "2018-12-19 09:10:02.197289", "stderr": "", "stdout": "Paused for 0.01 minutes", "stop": "2018-12-19 09:10:02.639081", "user_input": "" } Read vars_file 'config.cfg'

TASK [Set facts based on the input] ******************************************** task path: /root/algo/input.yml:104 ok: [localhost] => { "ansible_facts": { "algo_local_dns": false, "algo_ondemand_cellular": false, "algo_ondemand_wifi": false, "algo_ondemand_wifi_exclude": "_null", "algo_server_name": "algo", "algo_ssh_tunneling": false, "algo_store_cakey": false, "algo_windows": false }, "changed": false } META: ran handlers META: ran handlers Read vars_file 'config.cfg' Read vars_file 'config.cfg'

PLAY [Provision the server] **************************************************** Read vars_file 'config.cfg' Using module file /root/algo/env/local/lib/python2.7/site-packages/ansible/modules/system/setup.py ESTABLISH LOCAL CONNECTION FOR USER: root EXEC /bin/sh -c 'echo ~ && sleep 0' EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp/ansible-tmp-1545235802.87-271044980043328" && echo ansible-tmp-1545235802.87-271044980043328="echo /root/.ansible/tmp/ansible-tmp-1545235802.87-271044980043328" ) && sleep 0' PUT /root/.ansible/tmp/ansible-local-2702CpnHfo/tmpqM7A41 TO /root/.ansible/tmp/ansible-tmp-1545235802.87-271044980043328/setup.py EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1545235802.87-271044980043328/ /root/.ansible/tmp/ansible-tmp-1545235802.87-271044980043328/setup.py && sleep 0' EXEC /bin/sh -c 'python /root/.ansible/tmp/ansible-tmp-1545235802.87-271044980043328/setup.py && sleep 0' EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1545235802.87-271044980043328/ > /dev/null 2>&1 && sleep 0'

TASK [Gathering Facts] ********************************************************* task path: /root/algo/cloud.yml:2 ok: [localhost] Read vars_file 'config.cfg' Read vars_file 'config.cfg' Using module file /root/algo/env/local/lib/python2.7/site-packages/ansible/modules/commands/command.py ESTABLISH LOCAL CONNECTION FOR USER: root EXEC /bin/sh -c 'echo ~ && sleep 0' EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp/ansible-tmp-1545235803.94-118884988304251" && echo ansible-tmp-1545235803.94-118884988304251="echo /root/.ansible/tmp/ansible-tmp-1545235803.94-118884988304251" ) && sleep 0' PUT /root/.ansible/tmp/ansible-local-2702CpnHfo/tmpOPcokU TO /root/.ansible/tmp/ansible-tmp-1545235803.94-118884988304251/command.py EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1545235803.94-118884988304251/ /root/.ansible/tmp/ansible-tmp-1545235803.94-118884988304251/command.py && sleep 0' EXEC /bin/sh -c 'python /root/.ansible/tmp/ansible-tmp-1545235803.94-118884988304251/command.py && sleep 0'

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

Algo running on: Ubuntu 18.04.1 LTS Created from git fork. Last commit: a6cd895 Fixes #1246 Python 2.7.15rc1 Runtime variables: algo_provider "ec2" algo_ondemand_cellular "False" algo_ondemand_wifi "False" algo_ondemand_wifi_exclude "_null" algo_local_dns "False" algo_ssh_tunneling "False" algo_windows "False" wireguard_enabled "True" dns_encryption "True" EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1545235803.94-118884988304251/ > /dev/null 2>&1 && sleep 0'

TASK [Display the invocation environment] ************************************** task path: /root/algo/playbooks/cloud-pre.yml:2 changed: [localhost -> localhost] => { "changed": true, "cmd": "./algo-showenv.sh 'algo_provider "ec2"' 'algo_ondemand_cellular "False"' 'algo_ondemand_wifi "False"' 'algo_ondemand_wifi_exclude "_null"' 'algo_local_dns "False"' 'algo_ssh_tunneling "False"' 'algo_windows "False"' 'wireguard_enabled "True"' 'dns_encryption "True"' > /dev/tty", "delta": "0:00:00.115985", "end": "2018-12-19 09:10:04.342858", "invocation": { "module_args": { "_raw_params": "./algo-showenv.sh 'algo_provider "ec2"' 'algo_ondemand_cellular "False"' 'algo_ondemand_wifi "False"' 'algo_ondemand_wifi_exclude "_null"' 'algo_local_dns "False"' 'algo_ssh_tunneling "False"' 'algo_windows "False"' 'wireguard_enabled "True"' 'dns_encryption "True"' > /dev/tty", "_uses_shell": true, "chdir": null, "creates": null, "executable": null, "removes": null, "stdin": null, "warn": true } }, "rc": 0, "start": "2018-12-19 09:10:04.226873", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": [] } Read vars_file 'config.cfg' Read vars_file 'config.cfg' Using module file /root/algo/env/local/lib/python2.7/site-packages/ansible/modules/packaging/language/pip.py ESTABLISH LOCAL CONNECTION FOR USER: root EXEC /bin/sh -c 'echo ~ && sleep 0' EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp/ansible-tmp-1545235804.59-220286056713930" && echo ansible-tmp-1545235804.59-220286056713930="echo /root/.ansible/tmp/ansible-tmp-1545235804.59-220286056713930" ) && sleep 0' PUT /root/.ansible/tmp/ansible-local-2702CpnHfo/tmpUV8rUK TO /root/.ansible/tmp/ansible-tmp-1545235804.59-220286056713930/pip.py EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1545235804.59-220286056713930/ /root/.ansible/tmp/ansible-tmp-1545235804.59-220286056713930/pip.py && sleep 0' EXEC /bin/sh -c 'python /root/.ansible/tmp/ansible-tmp-1545235804.59-220286056713930/pip.py && sleep 0' EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1545235804.59-220286056713930/ > /dev/null 2>&1 && sleep 0'

TASK [Install the requirements] ************************************************ task path: /root/algo/playbooks/cloud-pre.yml:17 ok: [localhost -> localhost] => { "changed": false, "cmd": "/root/algo/env/bin/pip2 install -U pyOpenSSL jinja2==2.8 segno", "invocation": { "module_args": { "chdir": null, "editable": false, "executable": null, "extra_args": null, "name": [ "pyOpenSSL", "jinja2==2.8", "segno" ], "requirements": null, "state": "latest", "umask": null, "use_mirrors": true, "version": null, "virtualenv": null, "virtualenv_command": "virtualenv", "virtualenv_python": null, "virtualenv_site_packages": false } }, "name": [ "pyOpenSSL", "jinja2==2.8", "segno" ], "requirements": null, "state": "latest", "stderr": "", "stderr_lines": [], "stdout": "Requirement already up-to-date: pyOpenSSL in /root/algo/env/lib/python2.7/site-packages (18.0.0)\nRequirement already up-to-date: jinja2==2.8 in /root/algo/env/lib/python2.7/site-packages (2.8)\nRequirement already up-to-date: segno in /root/algo/env/lib/python2.7/site-packages (0.2.8)\nRequirement already satisfied, skipping upgrade: six>=1.5.2 in /root/algo/env/lib/python2.7/site-packages (from pyOpenSSL) (1.12.0)\nRequirement already satisfied, skipping upgrade: cryptography>=2.2.1 in /root/algo/env/lib/python2.7/site-packages (from pyOpenSSL) (2.4.2)\nRequirement already satisfied, skipping upgrade: MarkupSafe in /root/algo/env/lib/python2.7/site-packages (from jinja2==2.8) (1.1.0)\nRequirement already satisfied, skipping upgrade: enum34; python_version < "3" in /root/algo/env/lib/python2.7/site-packages (from cryptography>=2.2.1->pyOpenSSL) (1.1.6)\nRequirement already satisfied, skipping upgrade: idna>=2.1 in /root/algo/env/lib/python2.7/site-packages (from cryptography>=2.2.1->pyOpenSSL) (2.8)\nRequirement already satisfied, skipping upgrade: asn1crypto>=0.21.0 in /root/algo/env/lib/python2.7/site-packages (from cryptography>=2.2.1->pyOpenSSL) (0.24.0)\nRequirement already satisfied, skipping upgrade: cffi!=1.11.3,>=1.7 in /root/algo/env/lib/python2.7/site-packages (from cryptography>=2.2.1->pyOpenSSL) (1.11.5)\nRequirement already satisfied, skipping upgrade: ipaddress; python_version < "3" in /root/algo/env/lib/python2.7/site-packages (from cryptography>=2.2.1->pyOpenSSL) (1.0.22)\nRequirement already satisfied, skipping upgrade: pycparser in /root/algo/env/lib/python2.7/site-packages (from cffi!=1.11.3,>=1.7->cryptography>=2.2.1->pyOpenSSL) (2.19)\n", "stdout_lines": [ "Requirement already up-to-date: pyOpenSSL in /root/algo/env/lib/python2.7/site-packages (18.0.0)", "Requirement already up-to-date: jinja2==2.8 in /root/algo/env/lib/python2.7/site-packages (2.8)", "Requirement already up-to-date: segno in /root/algo/env/lib/python2.7/site-packages (0.2.8)", "Requirement already satisfied, skipping upgrade: six>=1.5.2 in /root/algo/env/lib/python2.7/site-packages (from pyOpenSSL) (1.12.0)", "Requirement already satisfied, skipping upgrade: cryptography>=2.2.1 in /root/algo/env/lib/python2.7/site-packages (from pyOpenSSL) (2.4.2)", "Requirement already satisfied, skipping upgrade: MarkupSafe in /root/algo/env/lib/python2.7/site-packages (from jinja2==2.8) (1.1.0)", "Requirement already satisfied, skipping upgrade: enum34; python_version < "3" in /root/algo/env/lib/python2.7/site-packages (from cryptography>=2.2.1->pyOpenSSL) (1.1.6)", "Requirement already satisfied, skipping upgrade: idna>=2.1 in /root/algo/env/lib/python2.7/site-packages (from cryptography>=2.2.1->pyOpenSSL) (2.8)", "Requirement already satisfied, skipping upgrade: asn1crypto>=0.21.0 in /root/algo/env/lib/python2.7/site-packages (from cryptography>=2.2.1->pyOpenSSL) (0.24.0)", "Requirement already satisfied, skipping upgrade: cffi!=1.11.3,>=1.7 in /root/algo/env/lib/python2.7/site-packages (from cryptography>=2.2.1->pyOpenSSL) (1.11.5)", "Requirement already satisfied, skipping upgrade: ipaddress; python_version < "3" in /root/algo/env/lib/python2.7/site-packages (from cryptography>=2.2.1->pyOpenSSL) (1.0.22)", "Requirement already satisfied, skipping upgrade: pycparser in /root/algo/env/lib/python2.7/site-packages (from cffi!=1.11.3,>=1.7->cryptography>=2.2.1->pyOpenSSL) (2.19)" ], "version": null, "virtualenv": null } Read vars_file 'config.cfg' Using module file /root/algo/env/local/lib/python2.7/site-packages/ansible/modules/crypto/openssl_privatekey.py ESTABLISH LOCAL CONNECTION FOR USER: root EXEC /bin/sh -c 'echo ~ && sleep 0' EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp/ansible-tmp-1545235806.1-143596176026624" && echo ansible-tmp-1545235806.1-143596176026624="echo /root/.ansible/tmp/ansible-tmp-1545235806.1-143596176026624" ) && sleep 0' PUT /root/.ansible/tmp/ansible-local-2702CpnHfo/tmpoQzZh4 TO /root/.ansible/tmp/ansible-tmp-1545235806.1-143596176026624/openssl_privatekey.py EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1545235806.1-143596176026624/ /root/.ansible/tmp/ansible-tmp-1545235806.1-143596176026624/openssl_privatekey.py && sleep 0' EXEC /bin/sh -c 'python /root/.ansible/tmp/ansible-tmp-1545235806.1-143596176026624/openssl_privatekey.py && sleep 0' EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1545235806.1-143596176026624/ > /dev/null 2>&1 && sleep 0'

TASK [Generate the SSH private key] ******************************************** task path: /root/algo/playbooks/cloud-pre.yml:27 ok: [localhost] => { "changed": false, "filename": "configs/algo.pem", "fingerprint": { "md5": "13:5f:9a:d6:79:72:2f:2c:f1:c9:da:12:12:02:88:11", "sha1": "f8:81:4f:c5:78:5d:65:cf:ea:f6:65:e7:41:be:b4:a5:0d:a9:f4:9e", "sha224": "7f:dc:89:7d:04:fb:93:05:0b:9e:99:60:de:b4:f7:7a:ff:7b:9c:ff:04:05:79:93:7e:31:4b:cb", "sha256": "7f:d7:94:aa:74:80:ae:dc:61:3f:0d:a4:5e:58:9a:11:d6:b1:43:45:9a:c6:e8:f4:58:85:d5:d1:0d:33:04:c4", "sha384": "e1:80:b3:13:18:67:86:51:8e:66:3f:f7:91:e6:f8:2d:26:e2:80:8a:ce:52:d8:39:fc:83:19:3b:af:c1:35:7d:ff:09:58:ec:ed:48:7c:b4:23:31:56:70:4b:17:a9:94", "sha512": "ee:0a:e0:ad:b0:52:36:c1:b8:de:51:e7:ed:0f:bd:ce:4b:77:09:8a:8f:3d:c5:dc:71:d4:60:e4:0c:49:c8:02:e4:d6:f1:19:5e:73:bd:c5:bb:6f:03:6d:a0:e9:58:a9:0e:d2:68:00:47:4b:f3:e5:82:88:84:1e:4a:87:88:18" }, "invocation": { "module_args": { "attributes": null, "backup": null, "cipher": null, "content": null, "delimiter": null, "directory_mode": null, "follow": false, "force": false, "group": null, "mode": "0600", "owner": null, "passphrase": null, "path": "configs/algo.pem", "regexp": null, "remote_src": null, "selevel": null, "serole": null, "setype": null, "seuser": null, "size": 2048, "src": null, "state": "present", "type": "RSA", "unsafe_writes": null } }, "size": 2048, "type": "RSA" } Read vars_file 'config.cfg' Using module file /root/algo/env/local/lib/python2.7/site-packages/ansible/modules/crypto/openssl_publickey.py ESTABLISH LOCAL CONNECTION FOR USER: root EXEC /bin/sh -c 'echo ~ && sleep 0' EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp/ansible-tmp-1545235806.8-102155407785211" && echo ansible-tmp-1545235806.8-102155407785211="echo /root/.ansible/tmp/ansible-tmp-1545235806.8-102155407785211" ) && sleep 0' PUT /root/.ansible/tmp/ansible-local-2702CpnHfo/tmp4cnWFl TO /root/.ansible/tmp/ansible-tmp-1545235806.8-102155407785211/openssl_publickey.py EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1545235806.8-102155407785211/ /root/.ansible/tmp/ansible-tmp-1545235806.8-102155407785211/openssl_publickey.py && sleep 0' EXEC /bin/sh -c 'python /root/.ansible/tmp/ansible-tmp-1545235806.8-102155407785211/openssl_publickey.py && sleep 0' EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1545235806.8-102155407785211/ > /dev/null 2>&1 && sleep 0'

TASK [Generate the SSH public key] ********************************************* task path: /root/algo/playbooks/cloud-pre.yml:34 ok: [localhost] => { "changed": false, "filename": "configs/algo.pem.pub", "fingerprint": { "md5": "13:5f:9a:d6:79:72:2f:2c:f1:c9:da:12:12:02:88:11", "sha1": "f8:81:4f:c5:78:5d:65:cf:ea:f6:65:e7:41:be:b4:a5:0d:a9:f4:9e", "sha224": "7f:dc:89:7d:04:fb:93:05:0b:9e:99:60:de:b4:f7:7a:ff:7b:9c:ff:04:05:79:93:7e:31:4b:cb", "sha256": "7f:d7:94:aa:74:80:ae:dc:61:3f:0d:a4:5e:58:9a:11:d6:b1:43:45:9a:c6:e8:f4:58:85:d5:d1:0d:33:04:c4", "sha384": "e1:80:b3:13:18:67:86:51:8e:66:3f:f7:91:e6:f8:2d:26:e2:80:8a:ce:52:d8:39:fc:83:19:3b:af:c1:35:7d:ff:09:58:ec:ed:48:7c:b4:23:31:56:70:4b:17:a9:94", "sha512": "ee:0a:e0:ad:b0:52:36:c1:b8:de:51:e7:ed:0f:bd:ce:4b:77:09:8a:8f:3d:c5:dc:71:d4:60:e4:0c:49:c8:02:e4:d6:f1:19:5e:73:bd:c5:bb:6f:03:6d:a0:e9:58:a9:0e:d2:68:00:47:4b:f3:e5:82:88:84:1e:4a:87:88:18" }, "format": "OpenSSH", "invocation": { "module_args": { "attributes": null, "backup": null, "content": null, "delimiter": null, "directory_mode": null, "follow": false, "force": false, "format": "OpenSSH", "group": null, "mode": null, "owner": null, "path": "configs/algo.pem.pub", "privatekey_passphrase": null, "privatekey_path": "configs/algo.pem", "regexp": null, "remote_src": null, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": null, "state": "present", "unsafe_writes": null } }, "privatekey": "configs/algo.pem" } META: ran handlers Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Read vars_file 'config.cfg' Using module file /root/algo/env/local/lib/python2.7/site-packages/ansible/modules/packaging/language/pip.py ESTABLISH LOCAL CONNECTION FOR USER: root EXEC /bin/sh -c 'echo ~ && sleep 0' EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp/ansible-tmp-1545235807.96-85956706940980" && echo ansible-tmp-1545235807.96-85956706940980="echo /root/.ansible/tmp/ansible-tmp-1545235807.96-85956706940980" ) && sleep 0' PUT /root/.ansible/tmp/ansible-local-2702CpnHfo/tmp83LBOS TO /root/.ansible/tmp/ansible-tmp-1545235807.96-85956706940980/pip.py EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1545235807.96-85956706940980/ /root/.ansible/tmp/ansible-tmp-1545235807.96-85956706940980/pip.py && sleep 0' EXEC /bin/sh -c 'python /root/.ansible/tmp/ansible-tmp-1545235807.96-85956706940980/pip.py && sleep 0' EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1545235807.96-85956706940980/ > /dev/null 2>&1 && sleep 0'

TASK [cloud-ec2 : Install requirements] **************************************** task path: /root/algo/roles/cloud-ec2/tasks/venv.yml:8 ok: [localhost] => { "changed": false, "cmd": "/root/algo/configs/.venvs/aws/bin/pip2 install -U boto>=2.5 boto3", "invocation": { "module_args": { "chdir": null, "editable": false, "executable": null, "extra_args": null, "name": [ "boto>=2.5", "boto3" ], "requirements": null, "state": "latest", "umask": null, "use_mirrors": true, "version": null, "virtualenv": "/root/algo/configs/.venvs/aws", "virtualenv_command": "virtualenv", "virtualenv_python": "python2.7", "virtualenv_site_packages": false } }, "name": [ "boto>=2.5", "boto3" ], "requirements": null, "state": "latest", "stderr": "", "stderr_lines": [], "stdout": "Requirement already up-to-date: boto>=2.5 in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (2.49.0)\nRequirement already up-to-date: boto3 in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (1.9.68)\nRequirement already satisfied, skipping upgrade: botocore<1.13.0,>=1.12.68 in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from boto3) (1.12.68)\nRequirement already satisfied, skipping upgrade: jmespath<1.0.0,>=0.7.1 in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from boto3) (0.9.3)\nRequirement already satisfied, skipping upgrade: s3transfer<0.2.0,>=0.1.10 in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from boto3) (0.1.13)\nRequirement already satisfied, skipping upgrade: docutils>=0.10 in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from botocore<1.13.0,>=1.12.68->boto3) (0.14)\nRequirement already satisfied, skipping upgrade: python-dateutil<3.0.0,>=2.1; python_version >= "2.7" in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from botocore<1.13.0,>=1.12.68->boto3) (2.7.5)\nRequirement already satisfied, skipping upgrade: urllib3<1.25,>=1.20; python_version == "2.7" in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from botocore<1.13.0,>=1.12.68->boto3) (1.24.1)\nRequirement already satisfied, skipping upgrade: futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from s3transfer<0.2.0,>=0.1.10->boto3) (3.2.0)\nRequirement already satisfied, skipping upgrade: six>=1.5 in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from python-dateutil<3.0.0,>=2.1; python_version >= "2.7"->botocore<1.13.0,>=1.12.68->boto3) (1.12.0)\n", "stdout_lines": [ "Requirement already up-to-date: boto>=2.5 in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (2.49.0)", "Requirement already up-to-date: boto3 in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (1.9.68)", "Requirement already satisfied, skipping upgrade: botocore<1.13.0,>=1.12.68 in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from boto3) (1.12.68)", "Requirement already satisfied, skipping upgrade: jmespath<1.0.0,>=0.7.1 in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from boto3) (0.9.3)", "Requirement already satisfied, skipping upgrade: s3transfer<0.2.0,>=0.1.10 in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from boto3) (0.1.13)", "Requirement already satisfied, skipping upgrade: docutils>=0.10 in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from botocore<1.13.0,>=1.12.68->boto3) (0.14)", "Requirement already satisfied, skipping upgrade: python-dateutil<3.0.0,>=2.1; python_version >= "2.7" in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from botocore<1.13.0,>=1.12.68->boto3) (2.7.5)", "Requirement already satisfied, skipping upgrade: urllib3<1.25,>=1.20; python_version == "2.7" in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from botocore<1.13.0,>=1.12.68->boto3) (1.24.1)", "Requirement already satisfied, skipping upgrade: futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from s3transfer<0.2.0,>=0.1.10->boto3) (3.2.0)", "Requirement already satisfied, skipping upgrade: six>=1.5 in /root/algo/configs/.venvs/aws/lib/python2.7/site-packages (from python-dateutil<3.0.0,>=2.1; python_version >= "2.7"->botocore<1.13.0,>=1.12.68->boto3) (1.12.0)" ], "version": null, "virtualenv": "/root/algo/configs/.venvs/aws" } Read vars_file 'config.cfg' [cloud-ec2 : pause] Enter your aws_access_key (http://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html) Note: Make sure to use an IAM user with an acceptable policy attached (see https://github.com/trailofbits/algo/blob/master/docs/deploy-from-ansible.md) (output is hidden):

TASK [cloud-ec2 : pause] ******************************************************* task path: /root/algo/roles/cloud-ec2/tasks/prompts.yml:2 ok: [localhost] => { "changed": false, "delta": 18, "echo": true, "rc": 0, "start": "2018-12-19 09:10:09.335489", "stderr": "", "stdout": "Paused for 0.31 minutes", "stop": "2018-12-19 09:10:28.031070", "user_input": "AKIAJNFGMSW2YWIELVUA" } Read vars_file 'config.cfg' [cloud-ec2 : pause] Enter your aws_secret_key (http://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html) (output is hidden):

TASK [cloud-ec2 : pause] ******************************************************* task path: /root/algo/roles/cloud-ec2/tasks/prompts.yml:12 ok: [localhost] => { "changed": false, "delta": 58, "echo": true, "rc": 0, "start": "2018-12-19 09:10:28.127090", "stderr": "", "stdout": "Paused for 0.97 minutes", "stop": "2018-12-19 09:11:26.415039", "user_input": "CoCVdaSUSz5ZbGH6//a4etSHEA7A3z/dMMBRVISJ" } Read vars_file 'config.cfg'

TASK [cloud-ec2 : set_fact] **************************************************** task path: /root/algo/roles/cloud-ec2/tasks/prompts.yml:21 ok: [localhost] => { "ansible_facts": { "access_key": "AKIAJNFGMSW2YWIELVUA", "secret_key": "*******************************************************" }, "changed": false } Read vars_file 'config.cfg' Using module file /root/algo/env/local/lib/python2.7/site-packages/ansible/modules/cloud/amazon/aws_region_facts.py ESTABLISH LOCAL CONNECTION FOR USER: root EXEC /bin/sh -c 'echo ~ && sleep 0' EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp/ansible-tmp-1545235886.75-37839366748763" && echo ansible-tmp-1545235886.75-37839366748763="echo /root/.ansible/tmp/ansible-tmp-1545235886.75-37839366748763" ) && sleep 0' PUT /root/.ansible/tmp/ansible-local-2702CpnHfo/tmpcM1_pL TO /root/.ansible/tmp/ansible-tmp-1545235886.75-37839366748763/aws_region_facts.py EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1545235886.75-37839366748763/ /root/.ansible/tmp/ansible-tmp-1545235886.75-37839366748763/aws_region_facts.py && sleep 0' EXEC /bin/sh -c 'PYTHONPATH=/root/algo/configs/.venvs/aws/lib/python2.7/site-packages/ python /root/.ansible/tmp/ansible-tmp-1545235886.75-37839366748763/aws_region_facts.py && sleep 0' EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1545235886.75-37839366748763/ > /dev/null 2>&1 && sleep 0'

TASK [cloud-ec2 : Get regions] ************************************************* task path: /root/algo/roles/cloud-ec2/tasks/prompts.yml:26 The full traceback is: Traceback (most recent call last): File "/tmp/ansible_OJoio3/ansible_module_aws_region_facts.py", line 98, in main Filters=ansible_dict_to_boto3_filter_list(sanitized_filters) File "/root/algo/configs/.venvs/aws/lib/python2.7/site-packages/botocore/client.py", line 320, in _api_call return self._make_api_call(operation_name, kwargs) File "/root/algo/configs/.venvs/aws/lib/python2.7/site-packages/botocore/client.py", line 624, in _make_api_call raise error_class(parsed_response, operation_name) ClientError: An error occurred (OptInRequired) when calling the DescribeRegions operation: You are not subscribed to this service. Please go to http://aws.amazon.com to subscribe.

fatal: [localhost]: FAILED! => { "changed": false, "error": { "code": "OptInRequired", "message": "You are not subscribed to this service. Please go to http://aws.amazon.com to subscribe." }, "invocation": { "module_args": { "aws_access_key": "AKIAJNFGMSW2YWIELVUA", "aws_secret_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "ec2_url": null, "filters": {}, "profile": null, "region": "us-east-1", "security_token": null, "validate_certs": true } }, "msg": "Unable to describe regions: An error occurred (OptInRequired) when calling the DescribeRegions operation: You are not subscribed to this service. Please go to http://aws.amazon.com to subscribe.", "response_metadata": { "http_headers": { "date": "Wed, 19 Dec 2018 16:11:00 GMT", "server": "AmazonEC2", "transfer-encoding": "chunked" }, "http_status_code": 401, "request_id": "b9dea607-bc8e-4507-ac29-8ca8f2e83288", "retry_attempts": 0 } } Read vars_file 'config.cfg'

TASK [cloud-ec2 : debug] ******************************************************* task path: /root/algo/roles/cloud-ec2/tasks/main.yml:45 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-ec2 : fail] ******************************************************** task path: /root/algo/roles/cloud-ec2/tasks/main.yml:47 fatal: [localhost]: FAILED! => { "changed": false, "msg": "Failed as requested from task" }

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

root@KII-235450:~/algo#`

mrphree avatar Dec 19 '18 15:12 mrphree

You can see that the service is being accessed and the keys are recognized as having been used this morning. Access key ID Created Last used Status AKIAJNFGMSW2YWIELVUA 2018-12-19 08:36 MST 2018-12-19 09:11 MST with ec2 in us-east-1 Active

mrphree avatar Dec 19 '18 17:12 mrphree

I could definitely see AWS allowing you to create keys but not use them to actually create an instance. It makes perfect sense by AWS standards.

Humor us, please, and confirm that you’ve got a working credit card signed up in the Billing section. I’ve seen that problem before.

TC1977 avatar Dec 19 '18 20:12 TC1977