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

Add allowed cidrs in agent configuration #188

Merged
merged 1 commit into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions agent/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ func Run(flags *Flags) {
}

log.Fatal(nginx.Run(config.Nginx, map[string]interface{}{
"allowed_cidrs": config.AllowedCidrs,
"port": flags.AgentRegistryPort,
"registry_server": nginx.GetServer(
config.Registry.Docker.HTTP.Net, config.Registry.Docker.HTTP.Addr),
Expand Down
1 change: 1 addition & 0 deletions agent/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ type Config struct {
RegistryBackup string `yaml:"registry_backup"`
Nginx nginx.Config `yaml:"nginx"`
TLS httputil.TLSConfig `yaml:"tls"`
AllowedCidrs []string `yaml:"allowed_cidrs"`
}
5 changes: 5 additions & 0 deletions config/agent/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ registry:

peer_id_factory: addr_hash

# Allow agent to only serve localhost and Docker default bridge requests.
allowed_cidrs:
- 127.0.0.1
- 172.17.0.1

nginx:
name: kraken-agent
cache_dir: /var/cache/kraken/kraken-agent/nginx/
Expand Down
6 changes: 3 additions & 3 deletions nginx/config/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ upstream registry-backend {
server {
listen {{.port}};

# Allow agent to only serve localhost and Docker default bridge requests.
allow 127.0.0.1;
allow 172.17.0.1;
{{range .allowed_cidrs}}
allow {{.}};
{{end}}
deny all;

{{.client_verification}}
Expand Down