config.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. // Package config manages the configuration
  2. package config
  3. import (
  4. "fmt"
  5. "strings"
  6. "github.com/spf13/viper"
  7. "github.com/drakkan/sftpgo/common"
  8. "github.com/drakkan/sftpgo/dataprovider"
  9. "github.com/drakkan/sftpgo/ftpd"
  10. "github.com/drakkan/sftpgo/httpclient"
  11. "github.com/drakkan/sftpgo/httpd"
  12. "github.com/drakkan/sftpgo/logger"
  13. "github.com/drakkan/sftpgo/sftpd"
  14. "github.com/drakkan/sftpgo/utils"
  15. "github.com/drakkan/sftpgo/version"
  16. "github.com/drakkan/sftpgo/webdavd"
  17. )
  18. const (
  19. logSender = "config"
  20. // DefaultConfigName defines the name for the default config file.
  21. // This is the file name without extension, we use viper and so we
  22. // support all the config files format supported by viper
  23. DefaultConfigName = "sftpgo"
  24. // ConfigEnvPrefix defines a prefix that ENVIRONMENT variables will use
  25. configEnvPrefix = "sftpgo"
  26. )
  27. var (
  28. globalConf globalConfig
  29. defaultSFTPDBanner = fmt.Sprintf("SFTPGo_%v", version.Get().Version)
  30. defaultFTPDBanner = fmt.Sprintf("SFTPGo %v ready", version.Get().Version)
  31. )
  32. type globalConfig struct {
  33. Common common.Configuration `json:"common" mapstructure:"common"`
  34. SFTPD sftpd.Configuration `json:"sftpd" mapstructure:"sftpd"`
  35. FTPD ftpd.Configuration `json:"ftpd" mapstructure:"ftpd"`
  36. WebDAVD webdavd.Configuration `json:"webdavd" mapstructure:"webdavd"`
  37. ProviderConf dataprovider.Config `json:"data_provider" mapstructure:"data_provider"`
  38. HTTPDConfig httpd.Conf `json:"httpd" mapstructure:"httpd"`
  39. HTTPConfig httpclient.Config `json:"http" mapstructure:"http"`
  40. }
  41. func init() {
  42. // create a default configuration to use if no config file is provided
  43. globalConf = globalConfig{
  44. Common: common.Configuration{
  45. IdleTimeout: 15,
  46. UploadMode: 0,
  47. Actions: common.ProtocolActions{
  48. ExecuteOn: []string{},
  49. Hook: "",
  50. },
  51. SetstatMode: 0,
  52. ProxyProtocol: 0,
  53. ProxyAllowed: []string{},
  54. },
  55. SFTPD: sftpd.Configuration{
  56. Banner: defaultSFTPDBanner,
  57. BindPort: 2022,
  58. BindAddress: "",
  59. MaxAuthTries: 0,
  60. HostKeys: []string{},
  61. KexAlgorithms: []string{},
  62. Ciphers: []string{},
  63. MACs: []string{},
  64. TrustedUserCAKeys: []string{},
  65. LoginBannerFile: "",
  66. EnabledSSHCommands: sftpd.GetDefaultSSHCommands(),
  67. KeyboardInteractiveHook: "",
  68. PasswordAuthentication: true,
  69. },
  70. FTPD: ftpd.Configuration{
  71. BindPort: 0,
  72. BindAddress: "",
  73. Banner: defaultFTPDBanner,
  74. BannerFile: "",
  75. ActiveTransfersPortNon20: false,
  76. ForcePassiveIP: "",
  77. PassivePortRange: ftpd.PortRange{
  78. Start: 50000,
  79. End: 50100,
  80. },
  81. CertificateFile: "",
  82. CertificateKeyFile: "",
  83. },
  84. WebDAVD: webdavd.Configuration{
  85. BindPort: 0,
  86. BindAddress: "",
  87. CertificateFile: "",
  88. CertificateKeyFile: "",
  89. Cors: webdavd.Cors{
  90. Enabled: false,
  91. AllowedOrigins: []string{},
  92. AllowedMethods: []string{},
  93. AllowedHeaders: []string{},
  94. ExposedHeaders: []string{},
  95. AllowCredentials: false,
  96. MaxAge: 0,
  97. },
  98. Cache: webdavd.Cache{
  99. Users: webdavd.UsersCacheConfig{
  100. ExpirationTime: 0,
  101. MaxSize: 50,
  102. },
  103. MimeTypes: webdavd.MimeCacheConfig{
  104. Enabled: true,
  105. MaxSize: 1000,
  106. },
  107. },
  108. },
  109. ProviderConf: dataprovider.Config{
  110. Driver: "sqlite",
  111. Name: "sftpgo.db",
  112. Host: "",
  113. Port: 5432,
  114. Username: "",
  115. Password: "",
  116. ConnectionString: "",
  117. SQLTablesPrefix: "",
  118. ManageUsers: 1,
  119. SSLMode: 0,
  120. TrackQuota: 1,
  121. PoolSize: 0,
  122. UsersBaseDir: "",
  123. Actions: dataprovider.UserActions{
  124. ExecuteOn: []string{},
  125. Hook: "",
  126. },
  127. ExternalAuthHook: "",
  128. ExternalAuthScope: 0,
  129. CredentialsPath: "credentials",
  130. PreLoginHook: "",
  131. PostLoginHook: "",
  132. PostLoginScope: 0,
  133. CheckPasswordHook: "",
  134. CheckPasswordScope: 0,
  135. PasswordHashing: dataprovider.PasswordHashing{
  136. Argon2Options: dataprovider.Argon2Options{
  137. Memory: 65536,
  138. Iterations: 1,
  139. Parallelism: 2,
  140. },
  141. },
  142. UpdateMode: 0,
  143. PreferDatabaseCredentials: false,
  144. },
  145. HTTPDConfig: httpd.Conf{
  146. BindPort: 8080,
  147. BindAddress: "127.0.0.1",
  148. TemplatesPath: "templates",
  149. StaticFilesPath: "static",
  150. BackupsPath: "backups",
  151. AuthUserFile: "",
  152. CertificateFile: "",
  153. CertificateKeyFile: "",
  154. },
  155. HTTPConfig: httpclient.Config{
  156. Timeout: 20,
  157. CACertificates: nil,
  158. SkipTLSVerify: false,
  159. },
  160. }
  161. viper.SetEnvPrefix(configEnvPrefix)
  162. replacer := strings.NewReplacer(".", "__")
  163. viper.SetEnvKeyReplacer(replacer)
  164. viper.SetConfigName(DefaultConfigName)
  165. setViperDefaults()
  166. viper.AutomaticEnv()
  167. viper.AllowEmptyEnv(true)
  168. }
  169. // GetCommonConfig returns the common protocols configuration
  170. func GetCommonConfig() common.Configuration {
  171. return globalConf.Common
  172. }
  173. // SetCommonConfig sets the common protocols configuration
  174. func SetCommonConfig(config common.Configuration) {
  175. globalConf.Common = config
  176. }
  177. // GetSFTPDConfig returns the configuration for the SFTP server
  178. func GetSFTPDConfig() sftpd.Configuration {
  179. return globalConf.SFTPD
  180. }
  181. // SetSFTPDConfig sets the configuration for the SFTP server
  182. func SetSFTPDConfig(config sftpd.Configuration) {
  183. globalConf.SFTPD = config
  184. }
  185. // GetFTPDConfig returns the configuration for the FTP server
  186. func GetFTPDConfig() ftpd.Configuration {
  187. return globalConf.FTPD
  188. }
  189. // SetFTPDConfig sets the configuration for the FTP server
  190. func SetFTPDConfig(config ftpd.Configuration) {
  191. globalConf.FTPD = config
  192. }
  193. // GetWebDAVDConfig returns the configuration for the WebDAV server
  194. func GetWebDAVDConfig() webdavd.Configuration {
  195. return globalConf.WebDAVD
  196. }
  197. // SetWebDAVDConfig sets the configuration for the WebDAV server
  198. func SetWebDAVDConfig(config webdavd.Configuration) {
  199. globalConf.WebDAVD = config
  200. }
  201. // GetHTTPDConfig returns the configuration for the HTTP server
  202. func GetHTTPDConfig() httpd.Conf {
  203. return globalConf.HTTPDConfig
  204. }
  205. // SetHTTPDConfig sets the configuration for the HTTP server
  206. func SetHTTPDConfig(config httpd.Conf) {
  207. globalConf.HTTPDConfig = config
  208. }
  209. //GetProviderConf returns the configuration for the data provider
  210. func GetProviderConf() dataprovider.Config {
  211. return globalConf.ProviderConf
  212. }
  213. //SetProviderConf sets the configuration for the data provider
  214. func SetProviderConf(config dataprovider.Config) {
  215. globalConf.ProviderConf = config
  216. }
  217. // GetHTTPConfig returns the configuration for HTTP clients
  218. func GetHTTPConfig() httpclient.Config {
  219. return globalConf.HTTPConfig
  220. }
  221. func getRedactedGlobalConf() globalConfig {
  222. conf := globalConf
  223. conf.ProviderConf.Password = "[redacted]"
  224. return conf
  225. }
  226. // LoadConfig loads the configuration
  227. // configDir will be added to the configuration search paths.
  228. // The search path contains by default the current directory and on linux it contains
  229. // $HOME/.config/sftpgo and /etc/sftpgo too.
  230. // configName is the name of the configuration to search without extension
  231. func LoadConfig(configDir, configName string) error {
  232. var err error
  233. viper.AddConfigPath(configDir)
  234. setViperAdditionalConfigPaths()
  235. viper.AddConfigPath(".")
  236. viper.SetConfigName(configName)
  237. if err = viper.ReadInConfig(); err != nil {
  238. logger.Warn(logSender, "", "error loading configuration file: %v", err)
  239. logger.WarnToConsole("error loading configuration file: %v", err)
  240. }
  241. err = viper.Unmarshal(&globalConf)
  242. if err != nil {
  243. logger.Warn(logSender, "", "error parsing configuration file: %v. Default configuration will be used: %+v",
  244. err, getRedactedGlobalConf())
  245. logger.WarnToConsole("error parsing configuration file: %v. Default configuration will be used.", err)
  246. return err
  247. }
  248. checkCommonParamsCompatibility()
  249. if strings.TrimSpace(globalConf.SFTPD.Banner) == "" {
  250. globalConf.SFTPD.Banner = defaultSFTPDBanner
  251. }
  252. if strings.TrimSpace(globalConf.FTPD.Banner) == "" {
  253. globalConf.FTPD.Banner = defaultFTPDBanner
  254. }
  255. if len(globalConf.ProviderConf.UsersBaseDir) > 0 && !utils.IsFileInputValid(globalConf.ProviderConf.UsersBaseDir) {
  256. err = fmt.Errorf("invalid users base dir %#v will be ignored", globalConf.ProviderConf.UsersBaseDir)
  257. globalConf.ProviderConf.UsersBaseDir = ""
  258. logger.Warn(logSender, "", "Configuration error: %v", err)
  259. logger.WarnToConsole("Configuration error: %v", err)
  260. }
  261. if globalConf.Common.UploadMode < 0 || globalConf.Common.UploadMode > 2 {
  262. err = fmt.Errorf("invalid upload_mode 0, 1 and 2 are supported, configured: %v reset upload_mode to 0",
  263. globalConf.Common.UploadMode)
  264. globalConf.Common.UploadMode = 0
  265. logger.Warn(logSender, "", "Configuration error: %v", err)
  266. logger.WarnToConsole("Configuration error: %v", err)
  267. }
  268. if globalConf.Common.ProxyProtocol < 0 || globalConf.Common.ProxyProtocol > 2 {
  269. err = fmt.Errorf("invalid proxy_protocol 0, 1 and 2 are supported, configured: %v reset proxy_protocol to 0",
  270. globalConf.Common.ProxyProtocol)
  271. globalConf.Common.ProxyProtocol = 0
  272. logger.Warn(logSender, "", "Configuration error: %v", err)
  273. logger.WarnToConsole("Configuration error: %v", err)
  274. }
  275. if globalConf.ProviderConf.ExternalAuthScope < 0 || globalConf.ProviderConf.ExternalAuthScope > 7 {
  276. err = fmt.Errorf("invalid external_auth_scope: %v reset to 0", globalConf.ProviderConf.ExternalAuthScope)
  277. globalConf.ProviderConf.ExternalAuthScope = 0
  278. logger.Warn(logSender, "", "Configuration error: %v", err)
  279. logger.WarnToConsole("Configuration error: %v", err)
  280. }
  281. if len(globalConf.ProviderConf.CredentialsPath) == 0 {
  282. err = fmt.Errorf("invalid credentials path, reset to \"credentials\"")
  283. globalConf.ProviderConf.CredentialsPath = "credentials"
  284. logger.Warn(logSender, "", "Configuration error: %v", err)
  285. logger.WarnToConsole("Configuration error: %v", err)
  286. }
  287. checkHostKeyCompatibility()
  288. logger.Debug(logSender, "", "config file used: '%#v', config loaded: %+v", viper.ConfigFileUsed(), getRedactedGlobalConf())
  289. return err
  290. }
  291. func checkHostKeyCompatibility() {
  292. // we copy deprecated fields to new ones to keep backward compatibility so lint is disabled
  293. if len(globalConf.SFTPD.Keys) > 0 && len(globalConf.SFTPD.HostKeys) == 0 { //nolint:staticcheck
  294. logger.Warn(logSender, "", "keys is deprecated, please use host_keys")
  295. logger.WarnToConsole("keys is deprecated, please use host_keys")
  296. for _, k := range globalConf.SFTPD.Keys { //nolint:staticcheck
  297. globalConf.SFTPD.HostKeys = append(globalConf.SFTPD.HostKeys, k.PrivateKey)
  298. }
  299. }
  300. }
  301. func checkCommonParamsCompatibility() {
  302. // we copy deprecated fields to new ones to keep backward compatibility so lint is disabled
  303. if globalConf.SFTPD.IdleTimeout > 0 { //nolint:staticcheck
  304. logger.Warn(logSender, "", "sftpd.idle_timeout is deprecated, please use common.idle_timeout")
  305. logger.WarnToConsole("sftpd.idle_timeout is deprecated, please use common.idle_timeout")
  306. globalConf.Common.IdleTimeout = globalConf.SFTPD.IdleTimeout //nolint:staticcheck
  307. }
  308. if len(globalConf.SFTPD.Actions.Hook) > 0 && len(globalConf.Common.Actions.Hook) == 0 { //nolint:staticcheck
  309. logger.Warn(logSender, "", "sftpd.actions is deprecated, please use common.actions")
  310. logger.WarnToConsole("sftpd.actions is deprecated, please use common.actions")
  311. globalConf.Common.Actions.ExecuteOn = globalConf.SFTPD.Actions.ExecuteOn //nolint:staticcheck
  312. globalConf.Common.Actions.Hook = globalConf.SFTPD.Actions.Hook //nolint:staticcheck
  313. }
  314. if globalConf.SFTPD.SetstatMode > 0 && globalConf.Common.SetstatMode == 0 { //nolint:staticcheck
  315. logger.Warn(logSender, "", "sftpd.setstat_mode is deprecated, please use common.setstat_mode")
  316. logger.WarnToConsole("sftpd.setstat_mode is deprecated, please use common.setstat_mode")
  317. globalConf.Common.SetstatMode = globalConf.SFTPD.SetstatMode //nolint:staticcheck
  318. }
  319. if globalConf.SFTPD.UploadMode > 0 && globalConf.Common.UploadMode == 0 { //nolint:staticcheck
  320. logger.Warn(logSender, "", "sftpd.upload_mode is deprecated, please use common.upload_mode")
  321. logger.WarnToConsole("sftpd.upload_mode is deprecated, please use common.upload_mode")
  322. globalConf.Common.UploadMode = globalConf.SFTPD.UploadMode //nolint:staticcheck
  323. }
  324. if globalConf.SFTPD.ProxyProtocol > 0 && globalConf.Common.ProxyProtocol == 0 { //nolint:staticcheck
  325. logger.Warn(logSender, "", "sftpd.proxy_protocol is deprecated, please use common.proxy_protocol")
  326. logger.WarnToConsole("sftpd.proxy_protocol is deprecated, please use common.proxy_protocol")
  327. globalConf.Common.ProxyProtocol = globalConf.SFTPD.ProxyProtocol //nolint:staticcheck
  328. globalConf.Common.ProxyAllowed = globalConf.SFTPD.ProxyAllowed //nolint:staticcheck
  329. }
  330. }
  331. func setViperDefaults() {
  332. viper.SetDefault("common.idle_timeout", globalConf.Common.IdleTimeout)
  333. viper.SetDefault("common.upload_mode", globalConf.Common.UploadMode)
  334. viper.SetDefault("common.actions.execute_on", globalConf.Common.Actions.ExecuteOn)
  335. viper.SetDefault("common.actions.hook", globalConf.Common.Actions.Hook)
  336. viper.SetDefault("common.setstat_mode", globalConf.Common.SetstatMode)
  337. viper.SetDefault("common.proxy_protocol", globalConf.Common.ProxyProtocol)
  338. viper.SetDefault("common.proxy_allowed", globalConf.Common.ProxyAllowed)
  339. viper.SetDefault("common.post_connect_hook", globalConf.Common.PostConnectHook)
  340. viper.SetDefault("sftpd.bind_port", globalConf.SFTPD.BindPort)
  341. viper.SetDefault("sftpd.bind_address", globalConf.SFTPD.BindAddress)
  342. viper.SetDefault("sftpd.max_auth_tries", globalConf.SFTPD.MaxAuthTries)
  343. viper.SetDefault("sftpd.banner", globalConf.SFTPD.Banner)
  344. viper.SetDefault("sftpd.host_keys", globalConf.SFTPD.HostKeys)
  345. viper.SetDefault("sftpd.kex_algorithms", globalConf.SFTPD.KexAlgorithms)
  346. viper.SetDefault("sftpd.ciphers", globalConf.SFTPD.Ciphers)
  347. viper.SetDefault("sftpd.macs", globalConf.SFTPD.MACs)
  348. viper.SetDefault("sftpd.trusted_user_ca_keys", globalConf.SFTPD.TrustedUserCAKeys)
  349. viper.SetDefault("sftpd.login_banner_file", globalConf.SFTPD.LoginBannerFile)
  350. viper.SetDefault("sftpd.enabled_ssh_commands", globalConf.SFTPD.EnabledSSHCommands)
  351. viper.SetDefault("sftpd.keyboard_interactive_auth_hook", globalConf.SFTPD.KeyboardInteractiveHook)
  352. viper.SetDefault("sftpd.password_authentication", globalConf.SFTPD.PasswordAuthentication)
  353. viper.SetDefault("ftpd.bind_port", globalConf.FTPD.BindPort)
  354. viper.SetDefault("ftpd.bind_address", globalConf.FTPD.BindAddress)
  355. viper.SetDefault("ftpd.banner", globalConf.FTPD.Banner)
  356. viper.SetDefault("ftpd.banner_file", globalConf.FTPD.BannerFile)
  357. viper.SetDefault("ftpd.active_transfers_port_non_20", globalConf.FTPD.ActiveTransfersPortNon20)
  358. viper.SetDefault("ftpd.force_passive_ip", globalConf.FTPD.ForcePassiveIP)
  359. viper.SetDefault("ftpd.passive_port_range.start", globalConf.FTPD.PassivePortRange.Start)
  360. viper.SetDefault("ftpd.passive_port_range.end", globalConf.FTPD.PassivePortRange.End)
  361. viper.SetDefault("ftpd.certificate_file", globalConf.FTPD.CertificateFile)
  362. viper.SetDefault("ftpd.certificate_key_file", globalConf.FTPD.CertificateKeyFile)
  363. viper.SetDefault("ftpd.tls_mode", globalConf.FTPD.TLSMode)
  364. viper.SetDefault("webdavd.bind_port", globalConf.WebDAVD.BindPort)
  365. viper.SetDefault("webdavd.bind_address", globalConf.WebDAVD.BindAddress)
  366. viper.SetDefault("webdavd.certificate_file", globalConf.WebDAVD.CertificateFile)
  367. viper.SetDefault("webdavd.certificate_key_file", globalConf.WebDAVD.CertificateKeyFile)
  368. viper.SetDefault("webdavd.cors.enabled", globalConf.WebDAVD.Cors.Enabled)
  369. viper.SetDefault("webdavd.cors.allowed_origins", globalConf.WebDAVD.Cors.AllowedOrigins)
  370. viper.SetDefault("webdavd.cors.allowed_methods", globalConf.WebDAVD.Cors.AllowedMethods)
  371. viper.SetDefault("webdavd.cors.allowed_headers", globalConf.WebDAVD.Cors.AllowedHeaders)
  372. viper.SetDefault("webdavd.cors.exposed_headers", globalConf.WebDAVD.Cors.ExposedHeaders)
  373. viper.SetDefault("webdavd.cors.allow_credentials", globalConf.WebDAVD.Cors.AllowCredentials)
  374. viper.SetDefault("webdavd.cors.max_age", globalConf.WebDAVD.Cors.MaxAge)
  375. viper.SetDefault("webdavd.cache.users.expiration_time", globalConf.WebDAVD.Cache.Users.ExpirationTime)
  376. viper.SetDefault("webdavd.cache.users.max_size", globalConf.WebDAVD.Cache.Users.MaxSize)
  377. viper.SetDefault("webdavd.cache.mime_types.enabled", globalConf.WebDAVD.Cache.MimeTypes.Enabled)
  378. viper.SetDefault("webdavd.cache.mime_types.max_size", globalConf.WebDAVD.Cache.MimeTypes.MaxSize)
  379. viper.SetDefault("data_provider.driver", globalConf.ProviderConf.Driver)
  380. viper.SetDefault("data_provider.name", globalConf.ProviderConf.Name)
  381. viper.SetDefault("data_provider.host", globalConf.ProviderConf.Host)
  382. viper.SetDefault("data_provider.port", globalConf.ProviderConf.Port)
  383. viper.SetDefault("data_provider.username", globalConf.ProviderConf.Username)
  384. viper.SetDefault("data_provider.password", globalConf.ProviderConf.Password)
  385. viper.SetDefault("data_provider.sslmode", globalConf.ProviderConf.SSLMode)
  386. viper.SetDefault("data_provider.connection_string", globalConf.ProviderConf.ConnectionString)
  387. viper.SetDefault("data_provider.sql_tables_prefix", globalConf.ProviderConf.SQLTablesPrefix)
  388. viper.SetDefault("data_provider.manage_users", globalConf.ProviderConf.ManageUsers)
  389. viper.SetDefault("data_provider.track_quota", globalConf.ProviderConf.TrackQuota)
  390. viper.SetDefault("data_provider.pool_size", globalConf.ProviderConf.PoolSize)
  391. viper.SetDefault("data_provider.users_base_dir", globalConf.ProviderConf.UsersBaseDir)
  392. viper.SetDefault("data_provider.actions.execute_on", globalConf.ProviderConf.Actions.ExecuteOn)
  393. viper.SetDefault("data_provider.actions.hook", globalConf.ProviderConf.Actions.Hook)
  394. viper.SetDefault("data_provider.external_auth_hook", globalConf.ProviderConf.ExternalAuthHook)
  395. viper.SetDefault("data_provider.external_auth_scope", globalConf.ProviderConf.ExternalAuthScope)
  396. viper.SetDefault("data_provider.credentials_path", globalConf.ProviderConf.CredentialsPath)
  397. viper.SetDefault("data_provider.prefer_database_credentials", globalConf.ProviderConf.PreferDatabaseCredentials)
  398. viper.SetDefault("data_provider.pre_login_hook", globalConf.ProviderConf.PreLoginHook)
  399. viper.SetDefault("data_provider.post_login_hook", globalConf.ProviderConf.PostLoginHook)
  400. viper.SetDefault("data_provider.post_login_scope", globalConf.ProviderConf.PostLoginScope)
  401. viper.SetDefault("data_provider.check_password_hook", globalConf.ProviderConf.CheckPasswordHook)
  402. viper.SetDefault("data_provider.check_password_scope", globalConf.ProviderConf.CheckPasswordScope)
  403. viper.SetDefault("data_provider.password_hashing.argon2_options.memory", globalConf.ProviderConf.PasswordHashing.Argon2Options.Memory)
  404. viper.SetDefault("data_provider.password_hashing.argon2_options.iterations", globalConf.ProviderConf.PasswordHashing.Argon2Options.Iterations)
  405. viper.SetDefault("data_provider.password_hashing.argon2_options.parallelism", globalConf.ProviderConf.PasswordHashing.Argon2Options.Parallelism)
  406. viper.SetDefault("data_provider.update_mode", globalConf.ProviderConf.UpdateMode)
  407. viper.SetDefault("httpd.bind_port", globalConf.HTTPDConfig.BindPort)
  408. viper.SetDefault("httpd.bind_address", globalConf.HTTPDConfig.BindAddress)
  409. viper.SetDefault("httpd.templates_path", globalConf.HTTPDConfig.TemplatesPath)
  410. viper.SetDefault("httpd.static_files_path", globalConf.HTTPDConfig.StaticFilesPath)
  411. viper.SetDefault("httpd.backups_path", globalConf.HTTPDConfig.BackupsPath)
  412. viper.SetDefault("httpd.auth_user_file", globalConf.HTTPDConfig.AuthUserFile)
  413. viper.SetDefault("httpd.certificate_file", globalConf.HTTPDConfig.CertificateFile)
  414. viper.SetDefault("httpd.certificate_key_file", globalConf.HTTPDConfig.CertificateKeyFile)
  415. viper.SetDefault("http.timeout", globalConf.HTTPConfig.Timeout)
  416. viper.SetDefault("http.ca_certificates", globalConf.HTTPConfig.CACertificates)
  417. viper.SetDefault("http.skip_tls_verify", globalConf.HTTPConfig.SkipTLSVerify)
  418. }