mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +03:00
sftpd: explicitly configure supported SFTP extensions
update pkg/sftp to a git revision that includes the needed patch https://github.com/pkg/sftp/pull/315
This commit is contained in:
@@ -28,6 +28,8 @@ import (
|
||||
|
||||
const defaultPrivateKeyName = "id_rsa"
|
||||
|
||||
var sftpExtensions = []string{"posix-rename@openssh.com"}
|
||||
|
||||
// Configuration for the SFTP server
|
||||
type Configuration struct {
|
||||
// Identification string used by the server
|
||||
@@ -153,6 +155,7 @@ func (c Configuration) Initialize(configDir string) error {
|
||||
|
||||
c.configureSecurityOptions(serverConfig)
|
||||
c.configureLoginBanner(serverConfig, configDir)
|
||||
c.configureSFTPExtensions()
|
||||
|
||||
listener, err := net.Listen("tcp", fmt.Sprintf("%s:%d", c.BindAddress, c.BindPort))
|
||||
if err != nil {
|
||||
@@ -208,6 +211,15 @@ func (c Configuration) configureLoginBanner(serverConfig *ssh.ServerConfig, conf
|
||||
return err
|
||||
}
|
||||
|
||||
func (c Configuration) configureSFTPExtensions() error {
|
||||
err := sftp.SetSFTPExtensions(sftpExtensions...)
|
||||
if err != nil {
|
||||
logger.WarnToConsole("unable to configure SFTP extensions: %v", err)
|
||||
logger.Warn(logSender, "", "unable to configure SFTP extensions: %v", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// AcceptInboundConnection handles an inbound connection to the server instance and determines if the request should be served or not.
|
||||
func (c Configuration) AcceptInboundConnection(conn net.Conn, config *ssh.ServerConfig) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user