Installing Fail2ban on Octoprint without basic http authentication

I don’t have http auth set for my Octoprint, and all guides I found required it for Fail2ban to work. I started looking around the Octoprint log files and found that the recent addition of Force Login plugin creates logs of failed logins to .octoprint/logs/octoprint.log file.

Installing and Setting up Fail2ban on Octoprint

Install fail2ban.

sudo apt-get install fail2ban

Create new jail file for octoprint in the jail.d folder.

sudo nano /etc/fail2ban/jail.d/octoprint.conf

Below is the jail.d config I have used for my setup. Bantime is 86400 seconds, meaning 24 hours. I’m only banning from http and https because I haven’t forwarded any other ports to my raspberry pi.

enabled = true
filter = octoprint
logpath = /home/pi/.octoprint/logs/octoprint.log
port = http,https
maxretry = 3
findtime = 10800
bantime = 86400
banaction = iptables-allports

Create new filter file for octoprint in the filter.d folder.

sudo nano /etc/fail2ban/filter.d/octoprint.conf

Below is the regex I have used for my setup.

# Fail2Ban filter for Octoprint login failures
before = common.conf
_daemon = app
failregex = - tornado.access - WARNING - 401 POST /api/login \(<HOST>\) .+$
ignoreregex =

The regex was made based on failed login in octoprint.log file, which looks like

2020-01-13 16:39:25,526 - tornado.access - WARNING - 401 POST /api/login (::ffff:XX.XXX.XX.XX) 17.58ms

Koti-Kajaani RSS-syöte

Paikallislehtemme Koti-Kajaani tarjoaa ilmaisen digilehden luettavaksi kaksi kertaa viikossa, mutta heillä ei ole valmista RSS-syötettä saatavilla, joten tein sitten itse oman versioni. Skriptit hakevat curlilla json-tiedot, josta sitten haetaan kaikki tarvittavat tiedot tietokantaan, ja PHP-skripti luo itse RSS-syötteen.

Syöte löytyy täältä: Koti-Kajaani RSS

Change Audio Output with Powershell in Windows 10

I have always wanted to change audio outputs in Windows 10 with a single key from my keyboard. I have a Steelseries Apex raw keyboard, which has a ton of macro keys, but there wasn’t a simple way to do it before. Not until I saw cdhunt’s WindowsAudioDevice-Powershell-Cmdlet. With this, I can simply create a one-line Powershell file for my Realtek Digital Output:

Set-AudioDevice -Index 3

Same goes for my Samsung TV and Acer monitor, which has inbuilt speakers. After this, I thought I was good to go, once I had set the script to one of my keyboard’s macro keys, but unfortunately Steelseries Engine 3 doesn’t support .ps1 files as executable macros. So, I had to turn to PS2EXE-GUI to turn my .ps1 files to .exe files. After this, I just had to point the macro key actions to right files and I was done.

Hopefully this helps someone else, who wants to do the same.

What Does OpenStack Offer To You?

It’s free and open source!

It offers a free alternative to VMware. The license costs for VMware are quite large if you are running a big cluster. OpenStack on the other hand is free, open sourced solution. Of course there are some costs; hardware, electricity, administration, OS licence if you decide to run it on RHEL.

You don’t have to take every component that comes with OpenStack. For example you can leave Swift out of your environment if you don’t need storage. OpenStack being open source means you can modify it how you want based on how it fits to your purposes. This also means that you don’t have to wait for your vendor to fix something small in the software that would come in the next update, which can cost money when you can do it yourself.

OpenStack’s Swift is quite versatile. It can be installed on a single server, which uses only one hard drive, but it is at best when installed on multiple servers.

Adding and removing storage nodes is fast and easy. Add the node to the storage ring configuration and re-balance it. Swift starts automatically replicating the stored files to the new node. Replication is done with rsync, fast and efficient software.

Recently PayPal replaced their 80 000 VMware servers with OpenStack. Their main reason was speed, as mentioned earlier it can take months for vendor to release a fix for something small. Full article and reasons can be found here. Another PayPal’s reason was scalability. They get sudden spikes of traffic and OpenStack can help and deploy new virtual machines to balance the load

My Take on Creating Windows Server 2008 R2 Image for OpenStack

I started to follow this guide since it felt like the best one found from the Google.

At first I had problems with finding a KVM-supported virtual machine. My laptop supports Intel VT-x, so I knew it should be possible. At first I tried Virtualbox, which I already had installed on this laptop, but after some testing, I found out that VirtualBox doesn’t have support for nested virtual machines. The request for this has been open for 4 years! After this I tried my Ubuntu VM on ESXi environment, but it wasn’t enabled there either. Lastly, I solved the problem with VMware Player. Luckily the engineers at VMware had decided to built the support for nested virtualization in their products.

The next problem I faced was with the VNC connection to the Windows Server. For some reason it decided to show only a small area of the Windows Server, which can be seen from the picture below. The map network drive box is cut off at the side and the bottom. This caused some problems, since you couldn’t really see much of the screen. I managed to install the Red Hat VirtIO ethernet drivers, so the Internet would work on it. I also enabled remote desktop connection and disabled the firewall.

Uploading to Glance was easy and there weren’t any problems with it. The OpenStack environment is running on Folsom release.

At first I tested the image with tiny flavor: 512MB RAM, 1 VCPU, 0GB Root Disk, 0GB Ephemeral Disk. It booted up fine and once a floating IP was assigned to it, you could use RDP and connect to it. This flavor doesn’t give you much to do since it only holds the 15GB base image and half of that is used by the Windows Server itself.

After this I tested 2nd flavor: 2GB RAM, 1 VCPU, 10GB Root Disk, 20GB Ephemeral Disk. This flavor gave me an error instantly. It took me a little while to realize that the base image I created had 15GB disk. There is no way it can fit on the 10GB root disk on 2nd flavor. Kind of a newbie mistake, but we learn from our mistakes, right? If you give a bigger root disk than the base image, you need to expand the base image or create a new drive from the unused space.

Windows Server shows the ephemeral disk as offline at first, so you have to put it online first. Then you have to initialize it and then format and assign a drive letter for it. Then it’s ready to use.

The only problem I have is that the Volumes can’t be attached to the Windows instance. OpenStack suggests /dev/vdc/ as a mounting path, and since it’s a path that is used on Linux machines, it won’t work with Windows. Using some other name doesn’t work either, e.g. “F:”.

My only problem has been solved with a single command. After the command below, the Windows Server could see the empty, offline volume that was attached via CLI. Attaching a volume to Windows instance doesn’t work on Horizon, it errors out instantly.

nova volume-attach <server> <volume> <device>

CA ARCserve and No Compute Resource Found On Specified Host

I was running CA ARCserve r16 on virtual Windows Server 2008 R2 machine. The environment it was running in had 3 physical VMware ESXi hosts and all of these were controlled by a single VMware vCenter server.

I had created a new virtual machine on one of the hosts so I could test backing up and restoring with ARCserve. When it came time to test to restore the whole virtual machine from the backup I had made earlier, I encountered this weird problem. Googling the error message didn’t help, because nobody had encountered it before. ARCserve had created an entry in the error log saying “CreateVM Failed with error msg – “Err_code: -133 CreateVM: Exception Raised – No Compute Resource Found On Specified Host. “.

This problem made me stumped and I tried several things to solve it. The solution was so simple. I was trying to restore the virtual machine to VMware vCenter’s server. For some reason vCenter didn’t know how to rely the request to one of the ESXi hosts, so the solution was to change the IP-address to point directly to ESXi host. I’m not saying this is the correct way to do things, but it solved the problem for me.

Checklist for formatting your computer

I’m sure there are lists like this on the Internet already, but I wanted to create my own list and publish it.

Things you want probably to back up:

  • Digital photos, remember to check all user profiles if you have multiple profiles on your computer
  • Recorded videos
  • Special hardware drivers, in case if your Windows/Linux can’t find them automatically
  • Downloaded files, I keep all downloaded files in C:\Zipit so I would just back up that folder
  • Possible music files from My Music folder, or somewhere else similar folder
  • .torrent files. If you are µTorrent user, it saves .torrent files to Application Data folder if you haven’t specified the folder in µTorrent settings.

I personally like to copy the following to a safe place to save time when I’m reinstalling everything back.

  • Different program settings. This is so you don’t have to waste time reconfiguring all programs again
  • Scripts for mIRC. I’m an active user of this program so this saves me time of trying to recode all of my scripts again
  • Browser bookmarks. I’m using Opera Link so it will automatically sync my bookmarks to fresh install of Opera browser

Could not determine your IP address on Invision Power Board

If you encounter “Could not determine your IP address” error message after installing Invision Power Board on your localhost or shared hosting and you don’t know what to do, continue reading.

Open up a file called ipsRegistry.php at *IPB rootdirectory*/admin/sources/base/ipsRegistry.php. Search the error message and you will see the following code

// Make sure we take a valid IP address

if ( ( ! self::instance()->ip_address OR self::instance()->ip_address == ‘…’ ) AND ! isset( $_SERVER[‘SHELL’] ) AND $_SERVER[‘SESSIONNAME’] != ‘Console’ )
print “Could not determine your IP address”;

Now comment that code out and you will be able to access your new forums.

You might also get this same error when you try to update your IPB forum installation. You can use the same trick and comment out the same code at ipsRegistry_setup.php. The path for this is *IPB rootdirectory*/admin/setup/sources/base/ipsRegistry_setup.php

If this helps, please leave a comment so I know 🙂