Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added VIRTUAL_ALLOW to limit access to container #36

Closed
itsafire opened this issue Sep 25, 2014 · 9 comments
Closed

Added VIRTUAL_ALLOW to limit access to container #36

itsafire opened this issue Sep 25, 2014 · 9 comments

Comments

@itsafire
Copy link

I did a change to nginx.tmpl to provide a VIRTUAL_ALLOW environment variable to limit access to containers. Adding -e VIRTUAL_ALLOW=10.1.1.0/24,10.1.3.55 will result in:

allow 10.1.1.0/24;
allow 10.1.3.55;
deny all;

@itsafire
Copy link
Author

The added code to the server section in nginx.tmpl:

    {{ $firstContainer := index $containers 0 }}
    {{ if $firstContainer.Env.VIRTUAL_ALLOW }}
        {{ range $i, $allowed := split $firstContainer.Env.VIRTUAL_ALLOW "," }}
            allow {{ $allowed }};
        {{ end }}
        deny all;
    {{ end }}

pirelenito added a commit to dockito/proxy that referenced this issue Nov 30, 2014
@md5
Copy link
Contributor

md5 commented Feb 23, 2015

I believe this can be closed since #106 was merged. See the README for instructions: https://github.com/jwilder/nginx-proxy/blob/master/README.md#custom-nginx-configuration

@jwilder jwilder closed this as completed Mar 4, 2015
@moul
Copy link

moul commented Apr 30, 2015

Hi, even if #106 lets us do the equivalent of this PR,

I think this PR is a better solution when you want to handle all the configuration from the proxyfied container with environment variables.
It's a little by annoying to put some configuration in the proxyfied container and update a file on the host.
particularly when you use nginx-proxy as the host nginx and want to just handle new containers without thinking about it

What do you think about keeping #106 to handle every cases, and use this PR as an additional method ?

@aimxhaisse
Copy link

👍

@tpiron
Copy link

tpiron commented Apr 30, 2015

👍

@md5
Copy link
Contributor

md5 commented May 1, 2015

@moul You guys might want to check out the discussion in #134. Two possible options discussed there are a JSON-formatted VIRTUAL_HOST_CONFIG variable or a naming convention for variables starting with NGINX_PROXY_* to expose any (or perhaps just most) Nginx settings.

@thaJeztah
Copy link
Contributor

Perhaps labels are an option too; e.g. org.jsonwilder.nginx-proxy.something=val

@md5
Copy link
Contributor

md5 commented May 2, 2015

@thaJeztah Thanks for the reminder about labels. I haven't gotten around to playing with them yet, unfortunately.

Looks like label support was added to go-dockerclient here: fsouza/go-dockerclient@bd32742

@md5
Copy link
Contributor

md5 commented May 2, 2015

This is relevant too: nginx-proxy/docker-gen#81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants