Ravinou / borgwarehouse

A fast and modern WebUI for a BorgBackup's central repository server.
https://borgwarehouse.com
GNU Affero General Public License v3.0
393 stars 21 forks source link

Logs folder on debian (baremetal installation without docker) #287

Closed fuzunspm closed 2 months ago

fuzunspm commented 2 months ago

Hi,

I followed all instructions and everything is working fine except logs folder and fail2ban setup. It does't create a logs folder on home folder or anywhere else so fail2ban fails to start with sample config. I tried to manually create folder and files but files are always empty on wrong password authentication attempts

Ravinou commented 2 months ago

Hello @fuzunspm 😀

If you are using BorgWarehouse in a classic installation on debian (baremetal), then the application logs will be where you specify in your service.

By default, if you don't specify anything, the logs on Debian will be in /var/log/syslog.

But you can modify the service so that they are in a specific file, for example, which you can have fail2ban analyze.

Here's an example to help you:

Stop your service :

systemctl stop borgwarehouse.service

Create your log's folder and apply rights :

sudo mkdir -p /var/log/borgwarehouse
sudo chown borgwarehouse:borgwarehouse /var/log/borgwarehouse
sudo chmod 755 /var/log/borgwarehouse

Edit your service to add output : /etc/systemd/system/borgwarehouse.service

[Unit]
Description=BorgWarehouse
Documentation=https://borgwarehouse.com
After=network.target

[Service]
Type=simple
User=borgwarehouse
WorkingDirectory=/home/borgwarehouse/borgwarehouse
ExecStart=/usr/bin/npm run start
Restart=on-failure
StandardOutput=file:/var/log/borgwarehouse/borgwarehouse.log
StandardError=file:/var/log/borgwarehouse/borgwarehouse.log

[Install]
WantedBy=multi-user.target

Reload your service and start it :

systemctl daemon-reload
systemctl start borgwarehouse.service

For SSH logs, they will necessarily be in /var/log/auth.log as it's your machine's daemon that's used, unlike Docker.

Let me know if I've been able to help 😊