ISSUE-203

This commit is contained in:
Andrea Spacca
2019-05-11 14:42:59 +02:00
parent 5bbafa9ed7
commit cc401433a6
6745 changed files with 436 additions and 5109502 deletions

View File

@ -187,6 +187,16 @@ var globalFlags = []cli.Flag{
Usage: "pass for http basic auth",
Value: "",
},
cli.StringFlag{
Name: "ip-whitelist",
Usage: "comma separated list of ips allowed to connect to the service",
Value: "",
},
cli.StringFlag{
Name: "ip-blacklist",
Usage: "comma separated list of ips not allowed to connect to the service",
Value: "",
},
}
type Cmd struct {
@ -297,6 +307,23 @@ func New() *Cmd {
options = append(options, server.HttpAuthCredentials(httpAuthUser, httpAuthPass))
}
applyIPFilter := false
ipFilterOptions := server.IPFilterOptions{}
if ipWhitelist := c.String("ip-whitelist"); ipWhitelist != "" {
applyIPFilter = true
ipFilterOptions.AllowedIPs = strings.Split(ipWhitelist, ",")
ipFilterOptions.BlockByDefault = true
}
if ipBlacklist := c.String("ip-blacklist"); ipBlacklist != "" {
applyIPFilter = true
ipFilterOptions.BlockedIPs = strings.Split(ipBlacklist, ",")
}
if applyIPFilter {
options = append(options, server.FilterOptions(ipFilterOptions))
}
switch provider := c.String("provider"); provider {
case "s3":
if accessKey := c.String("aws-access-key"); accessKey == "" {