From 2078d8822519fece08db76d12b06ad53823a8595 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Tue, 7 Apr 2026 10:13:38 -0500 Subject: update .net references --- docs/build.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/build.md b/docs/build.md index 1d3c8faf..79214930 100644 --- a/docs/build.md +++ b/docs/build.md @@ -3,7 +3,7 @@ ## Prerequisites 1. [Node.js](https://nodejs.org/en/download/current) v18 or greater (with npm 9.6 or greater) -1. [.NET SDK](https://dotnet.microsoft.com/en-us/download) 8.0 +1. [.NET SDK](https://dotnet.microsoft.com/en-us/download) 10.0 ## Easy Way -- cgit v1.2.3 From 7033851e42d1412c34c4022f6a8dd1632c64586e Mon Sep 17 00:00:00 2001 From: ofernander Date: Sun, 12 Apr 2026 18:40:01 -0700 Subject: feat: add username reg pattern matching to blacklist group Adds a field to that accepts a list of regular expressions matched against usernames. --- config/slskd.example.yml | 2 ++ docs/config.md | 4 ++++ src/slskd/Core/Options.cs | 16 ++++++++++++++++ src/slskd/Users/UserService.cs | 17 +++++++++++++++++ 4 files changed, 39 insertions(+) (limited to 'docs') diff --git a/config/slskd.example.yml b/config/slskd.example.yml index 72aadaed..ee72a2e0 100644 --- a/config/slskd.example.yml +++ b/config/slskd.example.yml @@ -112,6 +112,8 @@ # blacklisted: # members: # - +# patterns: +# - # cidrs: # - # user_defined: diff --git a/docs/config.md b/docs/config.md index 6ba449f0..1b77a674 100644 --- a/docs/config.md +++ b/docs/config.md @@ -489,6 +489,8 @@ Private and chat room messages from blacklisted users are also ignored. Users can be blacklisted by adding their username to the `members` list. Additionally, users can be blacklisted by IP address, or range of addresses by adding a CIDR entry to the `cidrs` list. +The `patterns` list accepts regular expressions matched against usernames. Any username matching one or more patterns will be blacklisted. This is useful for blocking bots or automated clients that share a common username prefix or suffix — for example, `^user` would block any username starting with `user`, and `_bot$` would block any username ending with `_bot`. Patterns follow the same case sensitivity rules as other user-defined regular expressions in the application — case insensitive by default, controlled by the `flags.case_sensitive_regex` option. + Users added to the blacklist will be blocked from enqueueing any new files. Any existing active or queued transfers will need to be cancelled manually. A managed blacklist file may also be used to achieve the same effects. Read more about this in the [Managed Blacklist](#managed-blacklist) section below. @@ -499,6 +501,8 @@ groups: blacklisted: members: - + patterns: + - cidrs: - ``` diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 7b38143e..dda1b7b5 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -1149,6 +1149,14 @@ namespace slskd /// public string[] Members { get; init; } = Array.Empty(); + /// + /// Gets the list of regular expression patterns matched against usernames. + /// Any username matching one or more patterns will be blacklisted. + /// Follows the same case sensitivity rules as other user-defined regular expressions + /// (case insensitive by default; controlled by the flags.case_sensitive_regex option). + /// + public string[] Patterns { get; init; } = Array.Empty(); + /// /// Gets the list of group CIDRs. /// @@ -1163,6 +1171,14 @@ namespace slskd { var results = new List(); + foreach (var pattern in Patterns ?? Array.Empty()) + { + if (!pattern.IsValidRegex()) + { + results.Add(new ValidationResult($"Blacklist username pattern '{pattern}' is not a valid regular expression")); + } + } + foreach (var cidr in Cidrs ?? Array.Empty()) { try diff --git a/src/slskd/Users/UserService.cs b/src/slskd/Users/UserService.cs index d8b24f4d..31c1e540 100644 --- a/src/slskd/Users/UserService.cs +++ b/src/slskd/Users/UserService.cs @@ -38,6 +38,7 @@ namespace slskd.Users using System.Collections.Generic; using System.Linq; using System.Net; + using System.Text.RegularExpressions; using System.Threading.Tasks; using NetTools; using Serilog; @@ -291,6 +292,8 @@ namespace slskd.Users /// A value indicating whether the specified user and/or IP are blacklisted. public bool IsBlacklisted(string username, IPAddress ipAddress = null) { + if (username is null) return false; + var blacklist = OptionsMonitor.CurrentValue.Transfers.Groups.Blacklisted; if (blacklist.Members.Contains(username)) @@ -298,6 +301,20 @@ namespace slskd.Users return true; } + // check username patterns (regex). respects the same case sensitivity flag used by other + // user-defined regular expressions throughout the application. + if (blacklist.Patterns.Length > 0) + { + var regexOptions = OptionsMonitor.CurrentValue.Flags.CaseSensitiveRegEx + ? RegexOptions.None + : RegexOptions.IgnoreCase; + + if (blacklist.Patterns.Any(p => Regex.IsMatch(username, p, regexOptions))) + { + return true; + } + } + // check the user-curated list of blacklisted CIDRs that exists along with the list of // blacklisted usernames. these CIDRs should be one-offs and would not be expected to appear in a // blacklist supplied by a third party (but might?) -- cgit v1.2.3 From 2c6fd16895ae29fb3803ff72b59ae8e3d6504db4 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 18 Apr 2026 22:35:07 -0500 Subject: update docs to reflect config changes --- docs/config.md | 134 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 68 insertions(+), 66 deletions(-) (limited to 'docs') diff --git a/docs/config.md b/docs/config.md index 6ba449f0..aac89f9a 100644 --- a/docs/config.md +++ b/docs/config.md @@ -349,7 +349,7 @@ A change to slot limits requires an application restart to take effect, while sp #### **YAML** ```yaml -global: +transfers: upload: slots: 20 speed_limit: 1000 # kibibytes @@ -372,19 +372,20 @@ Note that while it's possible to set the `failures` option for `queued`, it has #### **YAML** ```yaml -global: - limits: - queued: - files: 500 - megabytes: 5000 - daily: - files: 1000 - megabytes: 10000 - failures: 200 - weekly: - files: 5000 - megabytes: 50000 - failures: 1000 +transfers: + upload: + limits: + queued: + files: 500 + megabytes: 5000 + daily: + files: 1000 + megabytes: 10000 + failures: 200 + weekly: + files: 5000 + megabytes: 50000 + failures: 1000 ``` ## Groups @@ -408,18 +409,18 @@ upload: strategy: roundrobin # roundrobin or firstinfirstout slots: 10 # 1 to 2147483647 speed_limit: 100 # in KiB/s, 1 to 2147483647 -limits: - queued: - files: 500 # 1 to 2147483647 - megabytes: 5000 # 1 to 2147483647 - daily: - files: 1000 - megabytes: 10000 - failures: 200 # 1 to 2147483647 - weekly: - files: 5000 - megabytes: 50000 - failures: 1000 + limits: + queued: + files: 500 # 1 to 2147483647 + megabytes: 5000 # 1 to 2147483647 + daily: + files: 1000 + megabytes: 10000 + failures: 200 # 1 to 2147483647 + weekly: + files: 5000 + megabytes: 50000 + failures: 1000 ``` ## Built-In Groups @@ -434,45 +435,46 @@ It is impossible to explicitly assign users to these built-in groups, but the pr #### **YAML** ```yaml -groups: - default: - upload: - priority: 1 - strategy: roundrobin - slots: 10 - speed_limit: 50000 # kibibytes - limits: - queued: - files: 150 - megabytes: 1500 - daily: - files: 2147483647 # effectively unlimited, weekly still applies - megabytes: 2147483647 - weekly: - files: 1500 - megabytes: 15000 - failures: 150 - leechers: - thresholds: - files: 1 - directories: 1 - upload: - priority: 99 - strategy: roundrobin - slots: 1 - speed_limit: 100 - limits: - queued: - files: 15 - megabytes: 150 - daily: - files: 30 - megabytes: 300 - failures: 10 - weekly: - files: 150 - megabytes: 1500 - failures: 30 +transfers: + groups: + default: + upload: + priority: 1 + strategy: roundrobin + slots: 10 + speed_limit: 50000 # kibibytes + limits: + queued: + files: 150 + megabytes: 1500 + daily: + files: 2147483647 # effectively unlimited, weekly still applies + megabytes: 2147483647 + weekly: + files: 1500 + megabytes: 15000 + failures: 150 + leechers: + thresholds: + files: 1 + directories: 1 + upload: + priority: 99 + strategy: roundrobin + slots: 1 + speed_limit: 100 + limits: + queued: + files: 15 + megabytes: 150 + daily: + files: 30 + megabytes: 300 + failures: 10 + weekly: + files: 150 + megabytes: 1500 + failures: 30 ``` ## User Blacklist @@ -1093,7 +1095,7 @@ If unconfigured, the default timeout for requests is 5 seconds, and each request #### **YAML** ```yaml -integration: +integrations: webhooks: my_basic_webhook_using_defaults: on: -- cgit v1.2.3 From 67ba25c65bbe54d2d23701e95eef2d2bf1a87d75 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 18 Apr 2026 23:42:16 -0500 Subject: update docker --- docs/docker.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/docker.md b/docs/docker.md index 0d105927..b5fc00ea 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -7,20 +7,28 @@ Next, you'll need to make a few choices: * The HTTP and/or HTTPS ports for the slskd web UI (defaults 5030 and 5031) * The port for incoming connections from the Soulseek network (default 50300) * The directory for the slskd application data +* How you'll specify the user the container will run as (important for downloaded file permissions!) + +Two methods for specifying a user: +* Docker's built-in functionality; specify `--user` or `-u` in your `docker run` command, or add the `user:` key to your docker compose file +* The Linuxserver/*arr `PUID`/`PGID` method of passing user and group ID values in environment variables + +Docker's built-in functionality is objectively superior; the container starts and runs as the user you specify, it never has root privileges. The `PUID`/`PGID` method starts the container as root, updates the built-in `slskd` user's user and group IDs to match the values you provided, and changes the owner of your mounted app directory to that user. For most users, a quick start will be all that is needed: ```shell docker run -d \ - -p :5030 \ - -p :5031 \ - -p :50300 \ + -p 5030:5030 \ + -p 5031:5031 \ + -p 50300:50300 \ + -e SLSKD_REMOTE_CONFIGURATION=true \ -v :/app \ --name slskd \ slskd/slskd:latest ``` -This configuration, however, doesn't include any shared directories. +This configuration, however, doesn't include any shared directories, and any files that are downloaded will be owned by root. First, you need to map each share to the container as a volume. Then each local directory within the container needs to be added to the configuration. You may also need to specify the user and group ID that should run the container and own files created by slskd. The default is `root:root`, but Docker will accept any numeric values in the `UID:GID` format, such as `1000:1000` in this example. -- cgit v1.2.3