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

optional https port for s3 #4482

Merged
merged 3 commits into from
Jun 14, 2023
Merged

Conversation

kmlebedev
Copy link
Contributor

@kmlebedev kmlebedev commented May 18, 2023

What problem are we solving?

In kubernetes, traffic can be delivered through ingress, which itself allows you to do TLS and through the internal k8s service directly to the s3 api application and I would like to have additional https with TLS

It will also help to encrypt traffic if it not needs to be sent past the ingress #4479

How are we solving the problem?

optional https port for s3 api

How is the PR tested?

local with param -s3.port=8333 -s3.port.https=8433 -s3.key.file=/usr/local/share/ca-certificates/tls.key -s3.cert.file=/usr/local/share/ca-certificates/tls.crt

seaweedfs-s3-1      | I0518 12:26:07.332791 s3.go:263 Start Seaweed S3 API Server 30GB 3.50  at https port 8433
seaweedfs-s3-1      | I0518 12:26:07.333679 s3.go:281 Start Seaweed S3 API Server 30GB 3.50  at http port 8333

local with param -s3.port=8333 -s3.key.file=/usr/local/share/ca-certificates/tls.key -s3.cert.file=/usr/local/share/ca-certificates/tls.crt

seaweedfs-s3-1      | I0518 12:26:07.333679 s3.go:281 Start Seaweed S3 API Server 30GB 3.50  at https port 8333

local with param -s3.port=8333

seaweedfs-s3-1      | I0518 12:26:07.333679 s3.go:281 Start Seaweed S3 API Server 30GB 3.50  at http port 8333

Checks

  • I have added unit tests if possible.
  • I will add related wiki document changes and link to this PR after merging.

glog.V(0).Infof("Start Seaweed S3 API Server %s at https port %d", util.Version(), *s3opt.port)
if s3ApiLocalListener != nil {
if *s3opt.portHttps == 0 {
glog.V(0).Infof("Start Seaweed S3 API Server %s at https port %d", util.Version(), *s3opt.port)
Copy link
Collaborator

Choose a reason for hiding this comment

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

the message should be "http port"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. Should be http because this message in blok with tls key exist.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
glog.V(0).Infof("Start Seaweed S3 API Server %s at https port %d", util.Version(), *s3opt.port)
glog.V(0).Infof("Start Seaweed S3 API Server %s at http port %d", util.Version(), *s3opt.port)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chrislusf I didn’t successfully name the variable portHttps, but if it differs from 0 to zero, it means you need to run TLS on a separate port and in this code block only TLS is always started, so the message will always be https

logging on start

I0525 10:51:35.310073 s3.go:263 Start Seaweed S3 API Server 30GB 3.51 8e59d8fec at https port 443
I0525 10:51:35.310119 s3.go:281 Start Seaweed S3 API Server 30GB 3.51 8e59d8fec at http port 8080

@kmlebedev
Copy link
Contributor Author

@chrislusf Hey, is this getting better?

}
} else {
}
if *s3opt.tlsPrivateKey == "" || *s3opt.portHttps > 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure what is the intent here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure what is the intent here

@chrislusf The general idea is to run the s3 http server simultaneously on http and https different ports, while remaining backwards compatible when using a common port for http + TLS

Accordingly, this line allows you to start an http server without TLS on the "main" port, when TLS is already running on another https port

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did you see this comment ?

@kmlebedev
Copy link
Contributor Author

@chrislusf ping

@chrislusf
Copy link
Collaborator

@chrislusf Hey, is this getting better?

comments were not addressed yet.

@kmlebedev
Copy link
Contributor Author

comments were not addressed yet.

Ok. translated into resolved.

@chrislusf
Copy link
Collaborator

comments were not addressed yet.

Ok. translated into resolved.

They are marked as resolved. but no actual changes made.

kmlebedev pushed a commit to kmlebedev/seaweedfs that referenced this pull request May 26, 2023
# Conflicts:
#	weed/command/s3.go
@kmlebedev
Copy link
Contributor Author

@chrislusf How about a separate TLS port ?

@chrislusf
Copy link
Collaborator

I suspect you did not see my comments which were marked as resolved.

@kmlebedev kmlebedev requested a review from chrislusf June 14, 2023 06:46
Copy link
Contributor Author

@kmlebedev kmlebedev left a comment

Choose a reason for hiding this comment

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

try finish

glog.V(0).Infof("Start Seaweed S3 API Server %s at https port %d", util.Version(), *s3opt.port)
if s3ApiLocalListener != nil {
if *s3opt.portHttps == 0 {
glog.V(0).Infof("Start Seaweed S3 API Server %s at https port %d", util.Version(), *s3opt.port)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. Should be http because this message in blok with tls key exist.

}
} else {
}
if *s3opt.tlsPrivateKey == "" || *s3opt.portHttps > 0 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure what is the intent here

@chrislusf The general idea is to run the s3 http server simultaneously on http and https different ports, while remaining backwards compatible when using a common port for http + TLS

Accordingly, this line allows you to start an http server without TLS on the "main" port, when TLS is already running on another https port

glog.V(0).Infof("Start Seaweed S3 API Server %s at https port %d", util.Version(), *s3opt.port)
if s3ApiLocalListener != nil {
if *s3opt.portHttps == 0 {
glog.V(0).Infof("Start Seaweed S3 API Server %s at https port %d", util.Version(), *s3opt.port)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chrislusf I didn’t successfully name the variable portHttps, but if it differs from 0 to zero, it means you need to run TLS on a separate port and in this code block only TLS is always started, so the message will always be https

logging on start

I0525 10:51:35.310073 s3.go:263 Start Seaweed S3 API Server 30GB 3.51 8e59d8fec at https port 443
I0525 10:51:35.310119 s3.go:281 Start Seaweed S3 API Server 30GB 3.51 8e59d8fec at http port 8080

}
} else {
}
if *s3opt.tlsPrivateKey == "" || *s3opt.portHttps > 0 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did you see this comment ?

@kmlebedev
Copy link
Contributor Author

I suspect you did not see my comments which were marked as resolved.

It looks like I created a review and until I finished it all the messages were in the pending status

@chrislusf chrislusf merged commit 4dd890d into seaweedfs:master Jun 14, 2023
5 checks passed
chrislusf pushed a commit that referenced this pull request Jun 20, 2023
#4482

Co-authored-by: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.co>
kmlebedev added a commit to kmlebedev/seaweedfs that referenced this pull request Dec 22, 2023
Co-authored-by: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.co>
kmlebedev added a commit to kmlebedev/seaweedfs that referenced this pull request Dec 22, 2023
seaweedfs#4482

Co-authored-by: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.co>
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.

None yet

2 participants