Browse Source

Standardize -ip.bind flags to default to empty and fall back to -ip (#7945)

* Add documentation for issue #7941 fix

* rm FIX_ISSUE_7941.md

* Standardize -ip.bind flags to default to empty string and fall back to -ip option

- Change s3 command -ip.bind default logic to use -ip instead of localhost
- Change sftp command -ip.bind default to empty and fall back to 0.0.0.0
- Update help text for consistency

* Fix compilation error: add -ip flag to s3 command and update bindIp fallback

* Revert -ip flag addition for s3 command, set bindIp fallback to 0.0.0.0

* Update s3 command -ip.bind help text to reflect correct default behavior
pull/7952/head
Chris Lu 1 week ago
committed by GitHub
parent
commit
b97d17f79f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      weed/command/s3.go
  2. 5
      weed/command/sftp.go

4
weed/command/s3.go

@ -68,7 +68,7 @@ type S3Options struct {
func init() {
cmdS3.Run = runS3 // break init cycle
s3StandaloneOptions.filer = cmdS3.Flag.String("filer", "localhost:8888", "comma-separated filer server addresses for high availability")
s3StandaloneOptions.bindIp = cmdS3.Flag.String("ip.bind", "", "ip address to bind to. Default to localhost.")
s3StandaloneOptions.bindIp = cmdS3.Flag.String("ip.bind", "", "ip address to bind to. If empty, default to 0.0.0.0.")
s3StandaloneOptions.port = cmdS3.Flag.Int("port", 8333, "s3 server http listen port")
s3StandaloneOptions.portHttps = cmdS3.Flag.Int("port.https", 0, "s3 server https listen port")
s3StandaloneOptions.portGrpc = cmdS3.Flag.Int("port.grpc", 0, "s3 server grpc listen port")
@ -302,7 +302,7 @@ func (s3opt *S3Options) startS3Server() bool {
*s3opt.portGrpc = 10000 + *s3opt.port
}
if *s3opt.bindIp == "" {
*s3opt.bindIp = "localhost"
*s3opt.bindIp = "0.0.0.0"
}
if runtime.GOOS != "windows" {

5
weed/command/sftp.go

@ -60,7 +60,7 @@ func init() {
cmdSftp.Run = runSftp
sftpOptionsStandalone.filer = cmdSftp.Flag.String("filer", "localhost:8888", "filer server address (ip:port)")
sftpOptionsStandalone.bindIp = cmdSftp.Flag.String("ip.bind", "0.0.0.0", "ip address to bind SFTP server")
sftpOptionsStandalone.bindIp = cmdSftp.Flag.String("ip.bind", "", "ip address to bind to. If empty, default to 0.0.0.0.")
sftpOptionsStandalone.port = cmdSftp.Flag.Int("port", 2022, "SFTP server listen port")
sftpOptionsStandalone.sshPrivateKey = cmdSftp.Flag.String("sshPrivateKey", "", "path to the SSH private key file for host authentication")
sftpOptionsStandalone.hostKeysFolder = cmdSftp.Flag.String("hostKeysFolder", "", "path to folder containing SSH private key files for host authentication")
@ -95,6 +95,9 @@ func runSftp(cmd *Command, args []string) bool {
}
func (sftpOpt *SftpOptions) startSftpServer() bool {
if *sftpOpt.bindIp == "" {
*sftpOpt.bindIp = "0.0.0.0"
}
filerAddress := pb.ServerAddress(*sftpOpt.filer)
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client")

Loading…
Cancel
Save