Skip to content

Backend Setup


Before you can sync your .env files, you need a place to sync with that isn't one of your personal machines. For this we provide the Senf Backend.

Requirements

  • Linux Server
  • .NET 10 or higher
  • Git

Installation

  1. Clone the backend repository
git clone https://github.com/KaenguruuDev/Senf
  1. Restore and build the solution
cd Senf
mkdir -p publish

dotnet restore
dotnet publish ./Senf.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -o publish
  1. Create a Systemd Service senf.service:
[Unit]
Description=Senf Backend
After=network.target

[Service]
WorkingDirectory=[Path/To/Your/Senf/Installation]
ExecStart=[Path/To/Your/Dotnet] [Path/To/Your/Senf/Installation]/publish/Senf.dll run
Restart=always
RestartSec=5
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DATABASE_PATH=~/.local/share/senf/senf.db
Environment=PORT=5000 # You may configure a different port here if this one is already used by another application

[Install]
WantedBy=multi-user.targetroot
  1. Reload systemd and activate the service:
sudo systemctl daemon-reload
sudo systemctl start senf.service
  1. Verify
journalctl -u myservice.service -f

Watch for any errors or warnings about permission issues. Incorrect permissions may cause dotnet to store encryption keys as plaintext

Initial User Setup

Once the backend has been setup, you must create your first user through the backend CLI.

  1. Stop the service
sudo systemctl stop senf
  1. Create a new user
dotnet publish/Senf.dll add-user <username> "<public-key>" "<key-name>"

username: The username that will be associated with your SSH Keys in the Senf backend. Recommended characters: [a-zA-Z0-9-.]

public-key: The content of a *.pub file, usually located in ~/.ssh. If you do not have any SSH keys or want a separate key for Senf, you can follow these instructions

key-name: A unique name to make it easier to identify which key belongs to which machine.

  1. Start the service
sudo systemctl start senf
  1. Verify

To verify your login, you must first setup SenfCLI