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 disable ssl verify #131

Merged

Conversation

kkellerlbl
Copy link
Member

@kkellerlbl kkellerlbl commented Dec 10, 2020

Add a configuration option (default to false) that disables verification of the S3 SSL certificate (for example, if it is self-signed).

  • Add support for s3-disable-ssl-verify flag (default false)
  • Have minioClient constructor honor new flag
  • Have awscli constructor honor new flag
  • Have http.NewRequest honor new flag (will need to add option to NewS3FileStore constructor)
  • Add tests for self-signed cert flag
  • Test against a minio with a self-signed cert in a deploy env
  • Update version, documentation and release notes

...and hope minio creds can use the AWS creds object
NewWithRegion doesn't seem to like the (url, &minio.Options) call.  Try using the older (documented) style with this for setting a custom transport: minio/minio-go#1019
Forgot import
Still need to add flag to actual http.NewRequest call in StoreFile()
NewS3FileStore() takes an additional boolean argument for disableSSLVerify.  Hardcode `false` to each of those calls in the test suite.
For example, when using a self-signed certificate, disable verifying the cert in the PUT of a new object.
Need crypto/tls to specify custom transport config.
instead of DefaultClient (unsure what the real difference is if http.Client() just starts with a DefaultClient)
@codecov
Copy link

codecov bot commented Dec 10, 2020

Codecov Report

Merging #131 (3d4ff6f) into s3-disable-ssl-verify (5db1e52) will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@                    Coverage Diff                    @@
##           s3-disable-ssl-verify     #131      +/-   ##
=========================================================
+ Coverage                  91.14%   91.20%   +0.05%     
=========================================================
  Files                         14       14              
  Lines                       1412     1421       +9     
=========================================================
+ Hits                        1287     1296       +9     
  Misses                        92       92              
  Partials                      33       33              
Impacted Files Coverage Δ
config/config.go 100.00% <100.00%> (ø)
filestore/s3.go 90.41% <100.00%> (+0.20%) ⬆️
service/build.go 62.74% <100.00%> (+3.17%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5db1e52...3d4ff6f. Read the comment docs.

@kkellerlbl kkellerlbl merged commit cd6ed76 into kbase:s3-disable-ssl-verify Dec 10, 2020
Copy link
Member

@MrCreosote MrCreosote left a comment

Choose a reason for hiding this comment

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

Looks good, just a few smallish comments

deploy.cfg.example Show resolved Hide resolved
deploy.cfg.example Show resolved Hide resolved
TLSClientConfig: &tls.Config{InsecureSkipVerify: fs.disableSSLverify},
}
// Timeout: time.Second * 10,
httpClient := &http.Client{
Copy link
Member

Choose a reason for hiding this comment

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

Here we're creating a new client for every request, vs. http.DefaultClient which reuses a client. Do the client docs have any advice about this? The Java client recommends you share one client per process, for example.

If we want to share a client, I'd just create the client in the build code and replace the disableSSLverify arg with the client.

@@ -83,7 +83,7 @@ func (t *TestSuite) TestConstructWithGoodBucketNames() {
ls := b.String()
t.Equal(63, len(ls), "incorrect string length")
for _, bucket := range []string{"foo", ls} {
fstore, err := NewS3FileStore(cli, min, bucket)
fstore, err := NewS3FileStore(cli, min, bucket, false)
Copy link
Member

Choose a reason for hiding this comment

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

I would disable ssl for one of the happy path tests so the code is exercised, if not tested completely, and add a note to the top of the test file to that effect.

service/build.go Show resolved Hide resolved
awscli := s3.New(sess, &aws.Config{
Credentials: creds,
Endpoint: &cfg.S3Host,
Region: &cfg.S3Region,
DisableSSL: &cfg.S3DisableSSL,
HTTPClient: customHTTPClient,
Copy link
Member

Choose a reason for hiding this comment

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

I'm worried here that we're blowing away any specific http client customizations the aws and minio clients do. Are there any docs about that?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not that I could find.

@@ -35,6 +35,10 @@ const (
// KeyS3DisableSSL is the configuration key that determines whether SSL is to be used.
// any value other than 'true' is treated as false.
KeyS3DisableSSL = "s3-disable-ssl"
// KeyS3DisableSSLVerify is the configuration key that determines whether to verify the
Copy link
Member

Choose a reason for hiding this comment

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

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

Successfully merging this pull request may close these issues.

2 participants