diff options
| author | Mohamed Sekour <mohamed.sekour@exfo.com> | 2025-05-05 20:43:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-05 11:43:49 -0700 |
| commit | 93aed187e94dcaebf8e8f60cc5f180b49289649f (patch) | |
| tree | 7cc3796e3fb47487717539caefdcf2e34968047c /weed/command/filer.go | |
| parent | a2c5510ae1a17446c23d80eddb29d06df1fd0bbe (diff) | |
| download | seaweedfs-93aed187e94dcaebf8e8f60cc5f180b49289649f.tar.xz seaweedfs-93aed187e94dcaebf8e8f60cc5f180b49289649f.zip | |
Add SFTP Server Support (#6753)
* Add SFTP Server Support
Signed-off-by: Mohamed Sekour <mohamed.sekour@exfo.com>
* fix s3 tests and helm lint
Signed-off-by: Mohamed Sekour <mohamed.sekour@exfo.com>
* increase helm chart version
* adjust version
---------
Signed-off-by: Mohamed Sekour <mohamed.sekour@exfo.com>
Co-authored-by: chrislu <chris.lu@gmail.com>
Diffstat (limited to 'weed/command/filer.go')
| -rw-r--r-- | weed/command/filer.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/weed/command/filer.go b/weed/command/filer.go index d1241999a..05b1e88c7 100644 --- a/weed/command/filer.go +++ b/weed/command/filer.go @@ -35,6 +35,8 @@ var ( filerWebDavOptions WebDavOption filerStartIam *bool filerIamOptions IamOptions + filerStartSftp *bool + filerSftpOptions SftpOptions ) type FilerOptions struct { @@ -141,6 +143,19 @@ func init() { filerStartIam = cmdFiler.Flag.Bool("iam", false, "whether to start IAM service") filerIamOptions.ip = cmdFiler.Flag.String("iam.ip", *f.ip, "iam server http listen ip address") filerIamOptions.port = cmdFiler.Flag.Int("iam.port", 8111, "iam server http listen port") + + filerStartSftp = cmdFiler.Flag.Bool("sftp", false, "whether to start the SFTP server") + filerSftpOptions.port = cmdFiler.Flag.Int("sftp.port", 2022, "SFTP server listen port") + filerSftpOptions.sshPrivateKey = cmdFiler.Flag.String("sftp.sshPrivateKey", "", "path to the SSH private key file for host authentication") + filerSftpOptions.hostKeysFolder = cmdFiler.Flag.String("sftp.hostKeysFolder", "", "path to folder containing SSH private key files for host authentication") + filerSftpOptions.authMethods = cmdFiler.Flag.String("sftp.authMethods", "password,publickey", "comma-separated list of allowed auth methods: password, publickey, keyboard-interactive") + filerSftpOptions.maxAuthTries = cmdFiler.Flag.Int("sftp.maxAuthTries", 6, "maximum number of authentication attempts per connection") + filerSftpOptions.bannerMessage = cmdFiler.Flag.String("sftp.bannerMessage", "SeaweedFS SFTP Server - Unauthorized access is prohibited", "message displayed before authentication") + filerSftpOptions.loginGraceTime = cmdFiler.Flag.Duration("sftp.loginGraceTime", 2*time.Minute, "timeout for authentication") + filerSftpOptions.clientAliveInterval = cmdFiler.Flag.Duration("sftp.clientAliveInterval", 5*time.Second, "interval for sending keep-alive messages") + filerSftpOptions.clientAliveCountMax = cmdFiler.Flag.Int("sftp.clientAliveCountMax", 3, "maximum number of missed keep-alive messages before disconnecting") + filerSftpOptions.userStoreFile = cmdFiler.Flag.String("sftp.userStoreFile", "", "path to JSON file containing user credentials and permissions") + filerSftpOptions.localSocket = cmdFiler.Flag.String("sftp.localSocket", "", "default to /tmp/seaweedfs-sftp-<port>.sock") } func filerLongDesc() string { @@ -235,6 +250,18 @@ func runFiler(cmd *Command, args []string) bool { time.Sleep(delay * time.Second) filerIamOptions.startIamServer() }(startDelay) + startDelay++ + } + + if *filerStartSftp { + sftpOptions.filer = &filerAddress + if *f.dataCenter != "" && *filerSftpOptions.dataCenter == "" { + filerSftpOptions.dataCenter = f.dataCenter + } + go func(delay time.Duration) { + time.Sleep(delay * time.Second) + sftpOptions.startSftpServer() + }(startDelay) } f.masters = pb.ServerAddresses(*f.mastersString).ToServiceDiscovery() |
