Skip to content

Commit 0c09033

Browse files
authored
Merge pull request #109 from ryan-lane/aws-vault-ecs-server
Add an option to patch boto to support ecs-server mode of aws-vault
2 parents 258c932 + 25ee889 commit 0c09033

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.2.0
2+
3+
* Added `PATCH_ECS_ALLOWED_HOSTS` config setting, to support aws-vault's --ecs-server option
4+
15
## 2.1.0
26

37
* Fix for the gunicorn logging run location in gunicorn.conf, when trying to catch an exception that only exists in python3.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ script, or set via docker environment variables.
8989
| ROLE\_MAPPING\_FILE | Path String | | A json file that has a dict mapping of IP addresses to role names. Can be used if docker networking has been disabled and you are managing IP addressing for containers through another process. |
9090
| ROLE\_REVERSE\_LOOKUP | Boolean | False | Enable performing a reverse lookup of incoming IP addresses to match containers by hostname. Useful if you've disabled networking in docker, but set hostnames for containers in /etc/hosts or DNS. |
9191
| HOSTNAME\_MATCH\_REGEX | Regex String | `^.*$` | Limit reverse lookup container matching to hostnames that match the specified pattern. |
92+
| PATCH_ECS_ALLOWED_HOSTS | String | | Patch botocore's allowed hosts for ContainerMetadataFetcher to support aws-vault's --ecs-server option. This will inject the provided host into the allowed addresses botocore will allow for the AWS_CONTAINER_CREDENTIALS_FULL_URI environment. |
9293

9394
#### Default Roles
9495

metadataproxy/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
app.config.from_object(settings)
77
app.debug = app.config['DEBUG']
88

9+
if app.config['PATCH_ECS_ALLOWED_HOSTS']:
10+
from botocore.utils import ContainerMetadataFetcher # NOQA
11+
ContainerMetadataFetcher._ALLOWED_HOSTS.append(app.config['PATCH_ECS_ALLOWED_HOSTS'])
12+
913
if app.config['MOCK_API']:
1014
from metadataproxy.routes import mock # NOQA
1115
else:

metadataproxy/settings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,8 @@ def str_env(var_name, default=''):
111111
MESOS_STATE_URL = str_env('MESOS_STATE_URL', 'http://localhost:5051/state')
112112
# Timeout to use when calling the mesos state endpoint
113113
MESOS_STATE_TIMEOUT = int_env('MESOS_STATE_TIMEOUT', 2)
114+
115+
# Patch botocore's allowed hosts for ContainerMetadataFetcher to support aws-vault's
116+
# --ecs-server option. This will inject docker for mac's URL for the host into the
117+
# allowed addresses botocore will talk to.
118+
PATCH_ECS_ALLOWED_HOSTS = str_env('PATCH_ECS_ALLOWED_HOSTS')

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
setup(
2727
name="metadataproxy",
28-
version="2.1.0",
28+
version="2.2.0",
2929
packages=find_packages(exclude=["test*"]),
3030
include_package_data=True,
3131
zip_safe=False,

0 commit comments

Comments
 (0)