Setup housemon

 Based on Ubuntu 20.04:

sudo ufw status

sudo ufw default allow outgoing

sudo ufw default deny incoming

sudo ufw allow ssh

sudo ufw enable

sudo ufw status

sudo apt-get install fail2ban

sudo service fail2ban status

sudo vim /etc/fail2ban/jail.local

[DEFAULT]

 bantime = 8h

 ignoreip = 127.0.0.1/8 xxx.xxx.xxx.xxx

 ignoreself = true


 [sshd]

 enabled = true

 port = 22

 filter = sshd

 logpath = /var/log/auth.log

 maxretry = 3

sudo systemctl restart fail2ban

sudo iptables -L f2b-sshd --line-numbers

sudo service fail2ban status

sudo iptables -L f2b-sshd --line-numbers

sudo iptables -L

Install python via asdf.

Install poetry.

Install nginx.

Copy hm_server.tgz to server.

Untar hm_server.tgz in /opt/services.

sudo chown -R userx:userx /opt/services/hm_server

cp configs/hm_server.conf /etc/nginx/conf.d

cp configs/hm_server.service /etc/systemd/system/

Edit configs/hm_server.service for appropriate user.

sudo usermod -a -G www-data userx

cd /opt/services/hm_server 

python -m venv venv; . venv/bin/activate

poetry install

sudo ufw allow http

sudo ufw allow 4455

sudo systemctl start nginx

sudo systemctl start hm_server

service nginx status

service hm_server status

sudo lsof -i -P -n | grep LISTEN

Make sure cron job exists calling local hm_server to send temps.

If cloning the repo, don't forget to check:

 if __name__ == "__main__":

-    #    app.run(host="0.0.0.0")

-    app.run(host="0.0.0.0", debug=True, port=8000)

+    app.run(host="0.0.0.0")

+    # app.run(host="0.0.0.0", debug=True, port=8000)

in hm_server.py.

Set up for images:

sudo mkdir /var/www/images

sudo chgrp -R www-data /var/www/

sudo chmod g+w /var/www/images/

Edit /etc/nginx/sites-enabled/default:

 location / {

  # First attempt to serve request as file, then

  # as directory, then fall back to displaying a 404.

  try_files $uri $uri/ =404;

 }

Add:

 location /images/ {

  root /var/www;

 }




Popular posts from this blog

Opensuse Leap to Tumbleweed

MacOS VNC Screensaver fix