From aa0699646cca068f8303ef7aa5da75ee62b17f04 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 4 Jan 2023 08:24:03 -0600 Subject: tweak titles --- docs/docker.md | 2 +- docs/reverse_proxy.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/docker.md b/docs/docker.md index fc44fda7..e5e78251 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -1,4 +1,4 @@ -# Running slskd in Docker +# Running in Docker For most users, a quick start will be all that is needed: diff --git a/docs/reverse_proxy.md b/docs/reverse_proxy.md index 1ae2d4ed..d52ceb40 100644 --- a/docs/reverse_proxy.md +++ b/docs/reverse_proxy.md @@ -1,4 +1,4 @@ -# Running slskd Behind a Reverse Proxy +# Running Behind a Reverse Proxy ## NGINX -- cgit v1.2.3 From 42150caa504f20dfcb9dc8b27f46e413cc800449 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 4 Jan 2023 08:24:19 -0600 Subject: split requirements and known issues --- docs/known_issues.md | 27 +++++++++++++++++++++++++++ docs/system_requirements.md | 30 +----------------------------- 2 files changed, 28 insertions(+), 29 deletions(-) create mode 100644 docs/known_issues.md (limited to 'docs') diff --git a/docs/known_issues.md b/docs/known_issues.md new file mode 100644 index 00000000..a2f0041b --- /dev/null +++ b/docs/known_issues.md @@ -0,0 +1,27 @@ +# Known Issues + +## Any device with an ARMv6 or earlier processor + +Not supported by the .NET runtime. This may change in future versions. + +## Raspberry Pi Zero (any variant) + +At the moment all Pi Zeros are ARMv6. + +## Devices using a copy-on-write filesystem such as BTRFS or ZFS + +slskd uses SQLite to store transactional data associated with things like transfers and searches, and these reads and writes experience too much I/O latency for the application to work properly with these filesystems. + +Optimizations to the filesystems can be made to improve performance, but will come at a cost to most other use cases and are not recommended. + +slskd can still run on devices using these filesystems if application data can be stored on a separate disk or partition using a different filesystem, or potentially on a RAM disk (which would be volatile unless configured otherwise). + +Users can also enable 'volatile mode' (`SLSKD_VOLATILE` or `flags.volatile: true`), which will use in-memory SQLite tables. Searches and transfers will be lost when the application is restarted while in this mode. + +## Application data stored on network filesystems (NFS, SMB, Windows file sharing) + +For the same reasons as copy-on-write systems. + +## AWS EC2 t3a.nano with Ubuntu Linux + +The instance will run out of memory and crash every 12 hours or so. This instance size works when using Amazon Linux OS, but memory usage is very high and wouldn't be able to handle a lot of activity. \ No newline at end of file diff --git a/docs/system_requirements.md b/docs/system_requirements.md index 87241fab..e3a7e69b 100644 --- a/docs/system_requirements.md +++ b/docs/system_requirements.md @@ -6,32 +6,4 @@ Designed to run on a minimum of a Raspberry Pi 2 (or equivalent), or any system * at least 512mb RAM * at least 150mb disk space -Users concerned about optimal performance should consider something faster. - -# Known Issues - -## Any device with an ARMv6 or earlier processor - -Not supported by the .NET runtime. This may change in future versions. - -## Raspberry Pi Zero (any variant) - -At the moment all Pi Zeros are ARMv6. - -## Devices using a copy-on-write filesystem such as BTRFS or ZFS - -slskd uses SQLite to store transactional data associated with things like transfers and searches, and these reads and writes experience too much I/O latency for the application to work properly with these filesystems. - -Optimizations to the filesystems can be made to improve performance, but will come at a cost to most other use cases and are not recommended. - -slskd can still run on devices using these filesystems if application data can be stored on a separate disk or partition using a different filesystem, or potentially on a RAM disk (which would be volatile unless configured otherwise). - -Users can also enable 'volatile mode' (`SLSKD_VOLATILE` or `flags.volatile: true`), which will use in-memory SQLite tables. Searches and transfers will be lost when the application is restarted while in this mode. - -## Application data stored on network filesystems (NFS, SMB, Windows file sharing) - -For the same reasons as copy-on-write systems. - -## AWS EC2 t3a.nano with Ubuntu Linux - -The instance will run out of memory and crash every 12 hours or so. This instance size works when using Amazon Linux OS, but memory usage is very high and wouldn't be able to handle a lot of activity. \ No newline at end of file +Users concerned about optimal performance should consider something faster. \ No newline at end of file -- cgit v1.2.3 From c9f485ba5eefcae3911d83be2abd30001a2e665a Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 4 Jan 2023 08:24:28 -0600 Subject: add a root readme --- docs/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 docs/README.md (limited to 'docs') diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..f1a65308 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,16 @@ +# Documentation + +## Quick Start + +### [System Requirements](https://github.com/slskd/slskd/blob/master/docs/system_requirements.md) +### [Known Issues](https://github.com/slskd/slskd/blob/master/docs/known_issues.md) + +## Configuring slskd + +### [Application Configuration](https://github.com/slskd/slskd/blob/master/docs/config.md) + +## Running slskd + +### [In Docker](https://github.com/slskd/slskd/blob/master/docs/docker.md) +### [Behind a Reverse Proxy](https://github.com/slskd/slskd/blob/master/docs/reverse_proxy.md) +### [In Relay Mode](https://github.com/slskd/slskd/blob/master/docs/relay.md) \ No newline at end of file -- cgit v1.2.3 From 6acd4b59a303a41b685d6b75a684c718ac80897c Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 4 Jan 2023 09:37:31 -0600 Subject: wip relay docs --- docs/relay.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 docs/relay.md (limited to 'docs') diff --git a/docs/relay.md b/docs/relay.md new file mode 100644 index 00000000..f34e0000 --- /dev/null +++ b/docs/relay.md @@ -0,0 +1,66 @@ +# Relay Mode + +## What is Relay Mode? + +Relay mode refers to an optional configuration that allows two or more instances of slskd to work together over a network as one client. + +A relay configuration consists of one **Controller** and one or more **Agents**. + +The controller is the instance that connects to the Soulseek network and acts as the client; it's pretty much a standard instance of slskd. Agents are additional instances that connect to the controller, instead of the Soulseek network. These instances only relay files to the controller. + +You can think of Relay agents as 'remote storage' for slskd. + +Here's an example of a Relay configuration with one agents running in a user's home and a controller that's running on a server somewhere in the cloud: + + +```mermaid +C4Context + Boundary(Home, "Home", ""){ + System(Agent, "Agent", "Connects to controller") + } + + Boundary(Internet, "Internet", "") { + System(Controller, "Controller", "Connects to the Soulseek network") + + Boundary(Soulseek, "Soulseek Network", ""){ + System(Other, "Other Clients", "") + } + } + + Rel(Agent, Controller, "Files") + BiRel(Controller, Other, "Soulseek Traffic") + + UpdateRelStyle(Agent, Controller, $offsetY="-20", $offsetX="-10") + UpdateRelStyle(Controller, Other, $offsetY="-50") +``` + +## Why use Relay Mode? + +There's a number of reasons someone would want to use Relay mode: + +* You want to serve files from multiple locations, but don't want to have multiple Soulseek logins +* You are concerned about privacy and don't want to use (or don't trust) a VPN +* You want to want full functionality on the Soulseek network but can't configure port forwarding properly +* You are a high volume user and want to offload bandwidth from your home internet connection +* You want an always-on Soulseek client to preserve your place in remote queues, and don't have an always-on client at home + +For most of these use cases you can simply run an instance of slskd in the cloud, but that can get expensive and painful to manage if you're sharing a large number of files and/or add new files to your shares regularly. With a Relay you can point an agent to your local files and connect it to your cloud instance and get the best of both worlds. + +## Is Relay Mode Secure? + +Extra secure! + +All traffic between the Relay controller and agents is (optionally) sent over HTTPS, meaning it is end to end encrypted. + +Agents connect to the controller, not the other way around, meaning your home network doesn't need to forward any ports or enable any additional incoming traffic through firewalls. The only trust involved is in the address of the controller, which you control. + +All incoming requests to the controller must be secured with an API key, and each agent is configured with an additional shared secret to ensure authenticity. Agent configuration and API keys can be scoped to a specific IP address or CIDR block to ensure only authorized agents can connect, even if API keys and shared secrets are obtained by an attacker. + +## Quick Start + + + + +## How it Works + + \ No newline at end of file -- cgit v1.2.3 From 3a0e9729882d972886bd99382dca0b5ce9c97013 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 6 Jan 2023 15:48:27 -0600 Subject: quick start wip --- docs/relay.md | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 65 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/relay.md b/docs/relay.md index f34e0000..c78a0a7f 100644 --- a/docs/relay.md +++ b/docs/relay.md @@ -58,9 +58,70 @@ All incoming requests to the controller must be secured with an API key, and eac ## Quick Start - - +To start, you'll need two instances of slskd running on two different machines. Determine which is the controller (the instance that will connect to the Soulseek network) and which is the agent (the instance that will connect to the controller). -## How it Works +Next, generate two secrets with length between 16 and 255 characters; one to use as an API key, and another to use as the shared Relay secret. Use your favorite secret/password generator, or use slskd by running: - \ No newline at end of file +```bash +./slskd --generate-secret 32 +``` + +For this example we'll use `9tWy5c3NrmekKVWLQXBztz0hY7rNGlj1tGMfvHKmU1q` for the API key, and `BgI04SuVtsAYipxPHDpdxJsnVoPEeq4tKJeorWxr3Pj` for the shared secret. + +> Note: DO NOT copy/paste these values into your configuration! Use your own values, or you're opening yourself up to an attack! + +### Controller + +Next, we'll configure the controller. We'll enable the Relay, set this instance's mode to `controller`, and configure a single agent named `example_agent`. We'll accept connections from within our home network, which uses IP addresses in the 192.168.1.x range. + +We'll also need to create an API key, which we'll allow to be used from anywhere. We'll give the key the role `readwrite`, which is required for agents. + +```yaml +instance_name: controller +relay: + enabled: true + mode: controller + agents: + example_agent: + secret: BgI04SuVtsAYipxPHDpdxJsnVoPEeq4tKJeorWxr3Pj + cidr: 192.168.1.0/24 +web: + authentication: + api_keys: + example_api_key: + key: 9tWy5c3NrmekKVWLQXBztz0hY7rNGlj1tGMfvHKmU1q + role: readwrite + cidr: 192.168.1.0/24 +``` + +We'll start the agent, which is running on a machine with IP address 192.168.1.25. We should see the following logs (among many others): + +```bash + +``` + +### Agent + +Finally, we'll configure the agent. We'll enable the Relay, set this instance's mode to `agent`, and fill in the details of or controller. + +The controller is running on a machine with IP address 192.168.1.53, and we want to use HTTPS, so we'll use the URL `https://192.168.1.53:5001`. We're using the default self-signed certificate, so we'll need to `ignore_certificate_errors`. + +We'll copy the API key and secret from the controller config, and lastly, we want the agent to receive the files downloaded by the controller, so we'll set `downloads` to `true`. + +```yaml +relay: + enabled: true + mode: agent + controller: + address: https://192.168.1.53:5001 + ignore_certificate_errors: true + api_key: 9tWy5c3NrmekKVWLQXBztz0hY7rNGlj1tGMfvHKmU1q + secret: BgI04SuVtsAYipxPHDpdxJsnVoPEeq4tKJeorWxr3Pj + downloads: true +``` + +We'll start the agent and confirm that it connects to the controller and uploads its shares: + +```bash + +``` -- cgit v1.2.3 From ef7112e8ed423041f1f0f15343c856bae73e3e38 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 6 Jan 2023 16:45:49 -0600 Subject: more wip --- docs/relay.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/relay.md b/docs/relay.md index c78a0a7f..89f5bb3c 100644 --- a/docs/relay.md +++ b/docs/relay.md @@ -96,8 +96,8 @@ web: We'll start the agent, which is running on a machine with IP address 192.168.1.25. We should see the following logs (among many others): -```bash - +``` +[16:15:48 INF] Running in Controller relay mode. Listening for incoming Agent connections. ``` ### Agent @@ -109,11 +109,12 @@ The controller is running on a machine with IP address 192.168.1.53, and we want We'll copy the API key and secret from the controller config, and lastly, we want the agent to receive the files downloaded by the controller, so we'll set `downloads` to `true`. ```yaml +instance_name: example_agent relay: enabled: true mode: agent controller: - address: https://192.168.1.53:5001 + address: https://192.168.1.25:5001 ignore_certificate_errors: true api_key: 9tWy5c3NrmekKVWLQXBztz0hY7rNGlj1tGMfvHKmU1q secret: BgI04SuVtsAYipxPHDpdxJsnVoPEeq4tKJeorWxr3Pj -- cgit v1.2.3 From 9bb9c17312742adb65b37fe84bd64e7267defcd8 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 8 Jan 2023 13:29:32 -0600 Subject: finish relay docs --- docs/relay.md | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+), 8 deletions(-) (limited to 'docs') diff --git a/docs/relay.md b/docs/relay.md index 89f5bb3c..04e5915f 100644 --- a/docs/relay.md +++ b/docs/relay.md @@ -72,17 +72,19 @@ For this example we'll use `9tWy5c3NrmekKVWLQXBztz0hY7rNGlj1tGMfvHKmU1q` for the ### Controller -Next, we'll configure the controller. We'll enable the Relay, set this instance's mode to `controller`, and configure a single agent named `example_agent`. We'll accept connections from within our home network, which uses IP addresses in the 192.168.1.x range. +Next, we'll configure the controller. We'll enable the Relay, set this instance's mode to `controller`, and configure a single agent named `example`. We'll accept connections from within our home network, which uses IP addresses in the 192.168.1.x range. We'll also need to create an API key, which we'll allow to be used from anywhere. We'll give the key the role `readwrite`, which is required for agents. +Here's the entire `slskd.yml` file; feel free to copy and paste it over the contents of your file if you're following along (just replace the Soulseek credentials with your own): + ```yaml instance_name: controller relay: enabled: true mode: controller agents: - example_agent: + example: secret: BgI04SuVtsAYipxPHDpdxJsnVoPEeq4tKJeorWxr3Pj cidr: 192.168.1.0/24 web: @@ -92,9 +94,12 @@ web: key: 9tWy5c3NrmekKVWLQXBztz0hY7rNGlj1tGMfvHKmU1q role: readwrite cidr: 192.168.1.0/24 +soulseek: + username: + password: ``` -We'll start the agent, which is running on a machine with IP address 192.168.1.25. We should see the following logs (among many others): +We'll start the controller instance, which, in my case, is running on a machine with IP address `192.168.1.241`. We should see the following logs (among many others): ``` [16:15:48 INF] Running in Controller relay mode. Listening for incoming Agent connections. @@ -108,21 +113,77 @@ The controller is running on a machine with IP address 192.168.1.53, and we want We'll copy the API key and secret from the controller config, and lastly, we want the agent to receive the files downloaded by the controller, so we'll set `downloads` to `true`. +Agents must also set their instance name to the corresponding agent name in the controller. We configured `example` above, so this instance needs to be named `example`, as well. + +To demonstrate how file relays work, I've created a file `foo.txt` in `~/Music/test`, and I'll configure that directory as a share (`/home/kubuntu/Music` in my case). + +The entire `slskd.yml` file is below if you'd like to copy/paste it. Be sure to update the controller's address to the IP address of the machine the controller is working on. + ```yaml -instance_name: example_agent +instance_name: example relay: enabled: true mode: agent controller: - address: https://192.168.1.25:5001 + address: https://192.168.1.241:5001 ignore_certificate_errors: true api_key: 9tWy5c3NrmekKVWLQXBztz0hY7rNGlj1tGMfvHKmU1q secret: BgI04SuVtsAYipxPHDpdxJsnVoPEeq4tKJeorWxr3Pj downloads: true +shares: + directories: + - /home/kubuntu/Music ``` -We'll start the agent and confirm that it connects to the controller and uploads its shares: +We'll start the agent and confirm that it connects to the controller and uploads its shares (only pertinent logs shown): -```bash - ``` +[18:50:08 INF] Running in Agent relay mode; not connecting to the Soulseek server. +[18:50:08 INF] Attempting to connect to the relay controller https://192.168.1.241:5001 +[18:50:09 INF] Relay controller connection established. Awaiting authentication... +[18:50:09 INF] Authenticated. Uploading shares... +[18:50:09 INF] Beginning upload of shares (48.0 KB) +[18:50:10 INF] Upload of shares succeeded (48.0 KB in 136ms) +[18:50:10 INF] Shares uploaded. Ready to upload files. +``` + +The controller should show logs similar to the following: + +``` +[19:09:30 INF] Agent connection GyBMnXHfdomNzR2FEzT68Q from 192.168.1.250 established. Sending authentication challenge GU7pSFTG60skUtqM24FfB2WiUnWsC1LxYagBsz7edcp... +[19:09:30 INF] Agent connection GyBMnXHfdomNzR2FEzT68Q from 192.168.1.250 authenticated as agent example +[19:09:31 INF] Agent example (connection GyBMnXHfdomNzR2FEzT68Q) from 192.168.1.250 requested share upload token f81eb299-1a86-4f72-a77c-922d3f73106f +[19:09:31 INF] Handling share upload (f81eb299-1a86-4f72-a77c-922d3f73106f) from a caller claiming to be agent example +[19:09:31 INF] Agent example authenticated for token f81eb299-1a86-4f72-a77c-922d3f73106f. Beginning download of shares to /tmp/slskd/share_example_h0ycner1.svm.db +[19:09:31 INF] Download of shares from example (f81eb299-1a86-4f72-a77c-922d3f73106f) complete (48.0 KB in 2ms) +[19:09:31 INF] Loading shares from agent example +[19:09:31 INF] Warming browse response cache... +[19:09:31 INF] Shares from agent example ready. +[19:09:31 INF] Browse response cached successfully in 25ms +``` + +We're now ready to relay files! + +### Testing + +From another machine running a different Soulseek client, download the `foo.txt` file we shared as a test. The controller should show logs similar to the following: + +``` +[19:19:34 INF] Resolved Music\test\foo.txt to physical file /home/kubuntu/Music/test/foo.txt on host 'example' +[19:19:35 INF] Requested file Music\test\foo.txt from Agent example with ID 09e76dde-c4fa-4c50-8c25-d92a26b52102. Waiting for incoming connection. +[19:19:35 INF] Handling file upload of Music\test\foo.txt (09e76dde-c4fa-4c50-8c25-d92a26b52102) from a caller claiming to be agent example +[19:19:35 INF] Agent example authenticated for token 09e76dde-c4fa-4c50-8c25-d92a26b52102. Forwarding file stream for Music\test\foo.txt +[19:19:35 INF] Agent example provided file stream for file Music\test\foo.txt with ID 09e76dde-c4fa-4c50-8c25-d92a26b52102 +[19:19:35 INF] File upload of Music\test\foo.txt (09e76dde-c4fa-4c50-8c25-d92a26b52102) from agent example complete +``` + +And the agent should show: + +``` +[19:19:34 INF] Relay controller requested file info for Music\test\foo.txt with ID 468a42b3-e0ce-4562-850a-75dea2fd5701 +[19:19:35 INF] Relay controller requested file Music\test\foo.txt with ID 09e76dde-c4fa-4c50-8c25-d92a26b52102 +[19:19:35 INF] Beginning upload of file Music\test\foo.txt with ID 09e76dde-c4fa-4c50-8c25-d92a26b52102 +[19:19:35 INF] Upload of file Music\test\foo.txt with ID 09e76dde-c4fa-4c50-8c25-d92a26b52102 succeeded. +``` + +If the download completes and you see logs in the controller and agent that look similar to what's shown here, everything is working! \ No newline at end of file -- cgit v1.2.3