ensure that defaults defined in code match the default config file
Fixes #754 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
0bec1c6012
commit
7e7f662a23
5 changed files with 9 additions and 5 deletions
|
@ -187,9 +187,9 @@ func Init() {
|
|||
RateLimitersConfig: []common.RateLimiterConfig{defaultRateLimiter},
|
||||
},
|
||||
SFTPD: sftpd.Configuration{
|
||||
Banner: defaultSFTPDBanner,
|
||||
Bindings: []sftpd.Binding{defaultSFTPDBinding},
|
||||
MaxAuthTries: 0,
|
||||
Banner: defaultSFTPDBanner,
|
||||
HostKeys: []string{},
|
||||
KexAlgorithms: []string{},
|
||||
Ciphers: []string{},
|
||||
|
@ -259,7 +259,7 @@ func Init() {
|
|||
RootCert: "",
|
||||
ClientCert: "",
|
||||
ClientKey: "",
|
||||
TrackQuota: 1,
|
||||
TrackQuota: 2,
|
||||
PoolSize: 0,
|
||||
UsersBaseDir: "",
|
||||
Actions: dataprovider.ObjectsActions{
|
||||
|
@ -355,7 +355,7 @@ func Init() {
|
|||
TOTP: nil,
|
||||
},
|
||||
TelemetryConfig: telemetry.Conf{
|
||||
BindPort: 10000,
|
||||
BindPort: 0,
|
||||
BindAddress: "127.0.0.1",
|
||||
EnableProfiler: false,
|
||||
AuthUserFile: "",
|
||||
|
@ -572,6 +572,7 @@ func LoadConfig(configDir, configFile string) error {
|
|||
logger.Warn(logSender, "", "error loading configuration file: %v", err)
|
||||
logger.WarnToConsole("error loading configuration file: %v", err)
|
||||
}
|
||||
globalConf.MFAConfig.TOTP = []mfa.TOTPConfig{defaultTOTP}
|
||||
}
|
||||
err = viper.Unmarshal(&globalConf)
|
||||
if err != nil {
|
||||
|
|
|
@ -67,6 +67,8 @@ func TestLoadConfigFileNotFound(t *testing.T) {
|
|||
viper.SetConfigName("configfile")
|
||||
err := config.LoadConfig(os.TempDir(), "")
|
||||
assert.NoError(t, err)
|
||||
mfaConf := config.GetMFAConfig()
|
||||
assert.Len(t, mfaConf.TOTP, 1)
|
||||
}
|
||||
|
||||
func TestEmptyBanner(t *testing.T) {
|
||||
|
|
|
@ -133,7 +133,7 @@ The configuration file contains the following sections:
|
|||
- `debug`, boolean. If enabled any FTP command will be logged. This will generate a lot of logs. Enable only if you are investigating a client compatibility issue or something similar. You shouldn't leave this setting enabled for production servers. Default `false`.
|
||||
- `banner`, string. Greeting banner displayed when a connection first comes in. Leave empty to use the default banner. Default `SFTPGo <version> ready`, for example `SFTPGo 1.0.0-dev ready`.
|
||||
- `banner_file`, path to the banner file. The contents of the specified file, if any, are displayed when someone connects to the server. It can be a path relative to the config dir or an absolute one. If set, it overrides the banner string provided by the `banner` option. Leave empty to disable.
|
||||
- `active_transfers_port_non_20`, boolean. Do not impose the port 20 for active data transfers. Enabling this option allows to run SFTPGo with less privilege. Default: false.
|
||||
- `active_transfers_port_non_20`, boolean. Do not impose the port 20 for active data transfers. Enabling this option allows to run SFTPGo with less privilege. Default: `true`.
|
||||
- `passive_port_range`, struct containing the key `start` and `end`. Port Range for data connections. Random if not specified. Default range is 50000-50100.
|
||||
- `disable_active_mode`, boolean. Set to `true` to disable active FTP, default `false`.
|
||||
- `enable_site`, boolean. Set to true to enable the FTP SITE command. We support `chmod` and `symlink` if SITE support is enabled. Default `false`
|
||||
|
|
|
@ -16,7 +16,7 @@ const (
|
|||
var (
|
||||
supportedSSHCommands = []string{"scp", "md5sum", "sha1sum", "sha256sum", "sha384sum", "sha512sum", "cd", "pwd",
|
||||
"git-receive-pack", "git-upload-pack", "git-upload-archive", "rsync", "sftpgo-copy", "sftpgo-remove"}
|
||||
defaultSSHCommands = []string{"md5sum", "sha1sum", "cd", "pwd", "scp"}
|
||||
defaultSSHCommands = []string{"md5sum", "sha1sum", "sha256sum", "cd", "pwd", "scp"}
|
||||
sshHashCommands = []string{"md5sum", "sha1sum", "sha256sum", "sha384sum", "sha512sum"}
|
||||
systemCommands = []string{"git-receive-pack", "git-upload-pack", "git-upload-archive", "rsync"}
|
||||
serviceStatus ServiceStatus
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
"enabled_ssh_commands": [
|
||||
"md5sum",
|
||||
"sha1sum",
|
||||
"sha256sum",
|
||||
"cd",
|
||||
"pwd",
|
||||
"scp"
|
||||
|
|
Loading…
Reference in a new issue