mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-22 07:30:25 +00:00
remove reading data provider username and password from file
This reverts #1455 because the contributor cannot sign the CLA Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
590a1f1429
commit
26d19abf61
4 changed files with 3 additions and 27 deletions
|
@ -325,9 +325,7 @@ func Init() {
|
||||||
Host: "",
|
Host: "",
|
||||||
Port: 0,
|
Port: 0,
|
||||||
Username: "",
|
Username: "",
|
||||||
UsernameFile: "",
|
|
||||||
Password: "",
|
Password: "",
|
||||||
PasswordFile: "",
|
|
||||||
ConnectionString: "",
|
ConnectionString: "",
|
||||||
SQLTablesPrefix: "",
|
SQLTablesPrefix: "",
|
||||||
SSLMode: 0,
|
SSLMode: 0,
|
||||||
|
@ -2064,9 +2062,7 @@ func setViperDefaults() {
|
||||||
viper.SetDefault("data_provider.host", globalConf.ProviderConf.Host)
|
viper.SetDefault("data_provider.host", globalConf.ProviderConf.Host)
|
||||||
viper.SetDefault("data_provider.port", globalConf.ProviderConf.Port)
|
viper.SetDefault("data_provider.port", globalConf.ProviderConf.Port)
|
||||||
viper.SetDefault("data_provider.username", globalConf.ProviderConf.Username)
|
viper.SetDefault("data_provider.username", globalConf.ProviderConf.Username)
|
||||||
viper.SetDefault("data_provider.username_file", globalConf.ProviderConf.UsernameFile)
|
|
||||||
viper.SetDefault("data_provider.password", globalConf.ProviderConf.Password)
|
viper.SetDefault("data_provider.password", globalConf.ProviderConf.Password)
|
||||||
viper.SetDefault("data_provider.password_file", globalConf.ProviderConf.PasswordFile)
|
|
||||||
viper.SetDefault("data_provider.sslmode", globalConf.ProviderConf.SSLMode)
|
viper.SetDefault("data_provider.sslmode", globalConf.ProviderConf.SSLMode)
|
||||||
viper.SetDefault("data_provider.disable_sni", globalConf.ProviderConf.DisableSNI)
|
viper.SetDefault("data_provider.disable_sni", globalConf.ProviderConf.DisableSNI)
|
||||||
viper.SetDefault("data_provider.target_session_attrs", globalConf.ProviderConf.TargetSessionAttrs)
|
viper.SetDefault("data_provider.target_session_attrs", globalConf.ProviderConf.TargetSessionAttrs)
|
||||||
|
|
|
@ -392,11 +392,9 @@ type Config struct {
|
||||||
// Database port
|
// Database port
|
||||||
Port int `json:"port" mapstructure:"port"`
|
Port int `json:"port" mapstructure:"port"`
|
||||||
// Database username
|
// Database username
|
||||||
Username string `json:"username" mapstructure:"username"`
|
Username string `json:"username" mapstructure:"username"`
|
||||||
UsernameFile string `json:"username_file" mapstructure:"username_file"`
|
|
||||||
// Database password
|
// Database password
|
||||||
Password string `json:"password" mapstructure:"password"`
|
Password string `json:"password" mapstructure:"password"`
|
||||||
PasswordFile string `json:"password_file" mapstructure:"password_file"`
|
|
||||||
// Used for drivers mysql and postgresql.
|
// Used for drivers mysql and postgresql.
|
||||||
// 0 disable SSL/TLS connections.
|
// 0 disable SSL/TLS connections.
|
||||||
// 1 require ssl.
|
// 1 require ssl.
|
||||||
|
@ -915,22 +913,6 @@ func Initialize(cnf Config, basePath string, checkAdmins bool) error {
|
||||||
config.Actions.ExecuteOn = util.RemoveDuplicates(config.Actions.ExecuteOn, true)
|
config.Actions.ExecuteOn = util.RemoveDuplicates(config.Actions.ExecuteOn, true)
|
||||||
config.Actions.ExecuteFor = util.RemoveDuplicates(config.Actions.ExecuteFor, true)
|
config.Actions.ExecuteFor = util.RemoveDuplicates(config.Actions.ExecuteFor, true)
|
||||||
|
|
||||||
if config.UsernameFile != "" {
|
|
||||||
user, err := util.ReadConfigFromFile(config.UsernameFile, basePath)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
config.Username = user
|
|
||||||
}
|
|
||||||
|
|
||||||
if config.PasswordFile != "" {
|
|
||||||
password, err := util.ReadConfigFromFile(config.PasswordFile, basePath)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
config.Password = password
|
|
||||||
}
|
|
||||||
|
|
||||||
cnf.BackupsPath = getConfigPath(cnf.BackupsPath, basePath)
|
cnf.BackupsPath = getConfigPath(cnf.BackupsPath, basePath)
|
||||||
if cnf.BackupsPath == "" {
|
if cnf.BackupsPath == "" {
|
||||||
return fmt.Errorf("required directory is invalid, backup path %q", cnf.BackupsPath)
|
return fmt.Errorf("required directory is invalid, backup path %q", cnf.BackupsPath)
|
||||||
|
|
|
@ -523,7 +523,7 @@ func (c *Configuration) configureSecurityOptions(serverConfig *ssh.ServerConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Configuration) configureLoginBanner(serverConfig *ssh.ServerConfig, configDir string) {
|
func (c *Configuration) configureLoginBanner(serverConfig *ssh.ServerConfig, configDir string) {
|
||||||
if len(c.LoginBannerFile) > 0 {
|
if c.LoginBannerFile != "" {
|
||||||
bannerFilePath := c.LoginBannerFile
|
bannerFilePath := c.LoginBannerFile
|
||||||
if !filepath.IsAbs(bannerFilePath) {
|
if !filepath.IsAbs(bannerFilePath) {
|
||||||
bannerFilePath = filepath.Join(configDir, bannerFilePath)
|
bannerFilePath = filepath.Join(configDir, bannerFilePath)
|
||||||
|
|
|
@ -198,9 +198,7 @@
|
||||||
"host": "",
|
"host": "",
|
||||||
"port": 0,
|
"port": 0,
|
||||||
"username": "",
|
"username": "",
|
||||||
"username_file": "",
|
|
||||||
"password": "",
|
"password": "",
|
||||||
"password_file": "",
|
|
||||||
"sslmode": 0,
|
"sslmode": 0,
|
||||||
"disable_sni": false,
|
"disable_sni": false,
|
||||||
"target_session_attrs": "",
|
"target_session_attrs": "",
|
||||||
|
|
Loading…
Reference in a new issue