From b774289c6dc94908b246f087f088ad4317612e0e Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Fri, 3 Jun 2022 16:09:02 +0200 Subject: [PATCH] change default value for naming_rules to 1 Signed-off-by: Nicola Murino --- README.md | 2 +- config/config.go | 2 +- docs/full-configuration.md | 2 +- httpd/httpd_test.go | 1 + sftpgo.json | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2545f89c..9a4ec754 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Several storage backends are supported: local filesystem, encrypted local filesy - Per-protocol [rate limiting](./docs/rate-limiting.md) is supported and can be optionally connected to the built-in defender to automatically block hosts that repeatedly exceed the configured limit. - Per-user maximum concurrent sessions. - Per-user and global IP filters: login can be restricted to specific ranges of IP addresses or to a specific IP address. -- Per-user and per-directory shell like patterns filters: files can be allowed, denied or hidden based on shell like patterns. +- Per-user and per-directory shell like patterns filters: files can be allowed, denied and optionally hidden based on shell like patterns. - Automatically terminating idle connections. - Automatic blocklist management using the built-in [defender](./docs/defender.md). - Geo-IP filtering using a [plugin](https://github.com/sftpgo/sftpgo-plugin-geoipfilter). diff --git a/config/config.go b/config/config.go index 9d60ceba..ce8a4b6a 100644 --- a/config/config.go +++ b/config/config.go @@ -339,7 +339,7 @@ func Init() { UpdateMode: 0, DelayedQuotaUpdate: 0, CreateDefaultAdmin: false, - NamingRules: 0, + NamingRules: 1, IsShared: 0, BackupsPath: "backups", AutoBackup: dataprovider.AutoBackup{ diff --git a/docs/full-configuration.md b/docs/full-configuration.md index 3fd69b6d..4e2af7d6 100644 --- a/docs/full-configuration.md +++ b/docs/full-configuration.md @@ -246,7 +246,7 @@ The configuration file contains the following sections: - `password_caching`, boolean. Verifying argon2id passwords has a high memory and computational cost, verifying bcrypt passwords has a high computational cost, by enabling, in memory, password caching you reduce these costs. Default: `true` - `update_mode`, integer. Defines how the database will be initialized/updated. 0 means automatically. 1 means manually using the initprovider sub-command. - `create_default_admin`, boolean. Before you can use SFTPGo you need to create an admin account. If you open the admin web UI, a setup screen will guide you in creating the first admin account. You can automatically create the first admin account by enabling this setting and setting the environment variables `SFTPGO_DEFAULT_ADMIN_USERNAME` and `SFTPGO_DEFAULT_ADMIN_PASSWORD`. You can also create the first admin by loading initial data. This setting has no effect if an admin account is already found within the data provider. Default `false`. - - `naming_rules`, integer. Naming rules for usernames, folder and group names. `0` means no rules. `1` means you can use any UTF-8 character. The names are used in URIs for REST API and Web admin. If not set only unreserved URI characters are allowed: ALPHA / DIGIT / "-" / "." / "_" / "~". `2` means names are converted to lowercase before saving/matching and so case insensitive matching is possible. `3` means trimming trailing and leading white spaces before saving/matching. Rules can be combined, for example `3` means both converting to lowercase and allowing any UTF-8 character. Enabling these options for existing installations could be backward incompatible, some users could be unable to login, for example existing users with mixed cases in their usernames. You have to ensure that all existing users respect the defined rules. Default: `0`. + - `naming_rules`, integer. Naming rules for usernames, folder and group names. `0` means no rules. `1` means you can use any UTF-8 character. The names are used in URIs for REST API and Web admin. If not set only unreserved URI characters are allowed: ALPHA / DIGIT / "-" / "." / "_" / "~". `2` means names are converted to lowercase before saving/matching and so case insensitive matching is possible. `3` means trimming trailing and leading white spaces before saving/matching. Rules can be combined, for example `3` means both converting to lowercase and allowing any UTF-8 character. Enabling these options for existing installations could be backward incompatible, some users could be unable to login, for example existing users with mixed cases in their usernames. You have to ensure that all existing users respect the defined rules. Default: `1`. - `is_shared`, integer. If the data provider is shared across multiple SFTPGo instances, set this parameter to `1`. `MySQL`, `PostgreSQL` and `CockroachDB` can be shared, this setting is ignored for other data providers. For shared data providers, active transfers are persisted in the database and thus quota checks between ongoing transfers will work cross multiple instances. Password reset requests and OIDC tokens/states are also persisted in the database if the provider is shared. The database table `shared_sessions` is used only to store temporary sessions. In performance critical installations, you might consider using a database-specific optimization, for example you might use an `UNLOGGED` table for PostgreSQL. This optimization in only required in very limited use cases. Default: `0`. - `backups_path`, string. Path to the backup directory. This can be an absolute path or a path relative to the config dir. We don't allow backups in arbitrary paths for security reasons. - `auto_backup`, struct. Defines the configuration for automatic data provider backups. Example: hour `0` and day_of_week `*` means a backup every day at midnight. The backup file name is in the format `backup__.json`, files with the same name will be overwritten. Note, this process will only backup provider data (users, folders, shares, admins, api keys) and will not backup the configuration file and users files. diff --git a/httpd/httpd_test.go b/httpd/httpd_test.go index 85c08bf7..ed1ad635 100644 --- a/httpd/httpd_test.go +++ b/httpd/httpd_test.go @@ -285,6 +285,7 @@ func TestMain(m *testing.M) { logger.InitLogger(logfilePath, 5, 1, 28, false, false, zerolog.DebugLevel) os.Setenv("SFTPGO_COMMON__UPLOAD_MODE", "2") os.Setenv("SFTPGO_DATA_PROVIDER__CREATE_DEFAULT_ADMIN", "1") + os.Setenv("SFTPGO_DATA_PROVIDER__NAMING_RULES", "0") os.Setenv("SFTPGO_DEFAULT_ADMIN_USERNAME", "admin") os.Setenv("SFTPGO_DEFAULT_ADMIN_PASSWORD", "password") os.Setenv("SFTPGO_HTTPD__BINDINGS__0__WEB_CLIENT_INTEGRATIONS__0__URL", "http://127.0.0.1/test.html") diff --git a/sftpgo.json b/sftpgo.json index 6ca9ae41..1fe0ca97 100644 --- a/sftpgo.json +++ b/sftpgo.json @@ -230,7 +230,7 @@ "password_caching": true, "update_mode": 0, "create_default_admin": false, - "naming_rules": 0, + "naming_rules": 1, "is_shared": 0, "backups_path": "backups", "auto_backup": {