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

s3.go: Added options to use paths with S3 and the ability to disable SSL #3730

Merged
merged 4 commits into from
Jan 3, 2018
Merged
Show file tree
Hide file tree
Changes from 3 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
22 changes: 20 additions & 2 deletions physical/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ func NewS3Backend(conf map[string]string, logger log.Logger) (physical.Backend,
}
}
}
s3ForceStylePathStr, ok := conf["s3_force_style_path"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this and the following value to s3ForcePathStyle, which matches the actual parameter (PathStyle instead of StylePath).

if !ok {
s3ForceStylePathStr = "false"
}
s3ForceStylePathBool, err := strconv.ParseBool(s3ForceStylePathStr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use parseutil.ParseBool instead.

if err != nil {
return nil, fmt.Errorf("invalid boolean set for s3_force_style_path: '%s'", s3ForceStylePathStr)
}
disableSSLStr, ok := conf["disable_ssl"]
if !ok {
disableSSLStr = "false"
}
disableSSLBool, err := strconv.ParseBool(disableSSLStr)
if err != nil {
return nil, fmt.Errorf("invalid boolean set for disable_ssl: '%s'", disableSSLStr)
}

credsConfig := &awsutil.CredentialsConfig{
AccessKey: accessKey,
Expand All @@ -91,8 +107,10 @@ func NewS3Backend(conf map[string]string, logger log.Logger) (physical.Backend,
HTTPClient: &http.Client{
Transport: pooledTransport,
},
Endpoint: aws.String(endpoint),
Region: aws.String(region),
Endpoint: aws.String(endpoint),
Region: aws.String(region),
S3ForcePathStyle: aws.Bool(s3ForceStylePathBool),
DisableSSL: aws.Bool(disableSSLBool),
}))

_, err = s3conn.ListObjects(&s3.ListObjectsInput{Bucket: &bucket})
Expand Down
8 changes: 7 additions & 1 deletion website/source/docs/configuration/storage/s3.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,15 @@ cause Vault to attempt to retrieve credentials from the AWS metadata service.
- `session_token` `(string: "")` – Specifies the AWS session token. This can
also be provided via the environment variable `AWS_SESSION_TOKEN`.

- `max_parallel` `(string: "128")` – Specifies The maximum number of concurrent
- `max_parallel` `(string: "128")` – Specifies the maximum number of concurrent
requests to S3.

- `s3_force_style_path` `(string: "false")` - Specifies whether to use host
bucket style domains with the configured endpoint.

- `disable_ssl` `(string: "false")` - Specifies if SSL should be used for the
endpoint connection (highly recommended not to disable for production).

## `s3` Examples

### Default Example
Expand Down