Categories
Uncategorized

Scanning in Linux

I was having a mare trying to get scanning working on my USB HP Deskjet 2050.
Even though some of these settings are listed as defaults, it produces rubbish.

So I thought that I would document a working command!

Obviously you need to install the scan utilites
matt@server:~$ sudo apt install sane

Then list the devices:

matt@server:~$ scanimage -L device `hpaio:/usb/Deskjet_2050_J510_series?serial=XXXXXXXXXX' is a Hewlett-Packard Deskjet_2050_J510_series all-in-one

And use the output from above to specify the device:

scanimage -d "hpaio:/usb/Deskjet_2050_J510_series?serial=XXXXXXXXXX" --mode Color --resolution 200 --brightness 1000 --contrast 1000 -o scan9.jpg

Categories
Uncategorized

Fail2ban not picking up sshd attacks

It wasn’t working for me, no matter what I tried.
The command
fail2ban-regex /var/log/auth.log /etc/fail2ban/filter.d/sshd.conf
was showing matches successfully.

In the end I ran these commands… I’m fairly sure it was just the RepeatedMsgReduction setting to off that fixed it though

dpkg-reconfigure tzdata
ln -s /usr/share/zoneinfo/Europe/London /etc/localtime

vim /etc/rsyslog.conf
#Change this line of "off" so we can see all messages
$RepeatedMsgReduction off

Then
service rsyslog restart

Categories
Uncategorized

nginx case insensitive URL

There was a requirement for a website on the server to have a case-insensitive.

There is no simple option in nginx to make it case-insensitive, there are also no nested if statements available.

This isn’t easy to achieve, but the below seems to have done it me (for only 1 URI!)

location ~* ^/TNG/$ {
return 301 https://www.theirdomain.co.uk/TNG/index.php;
}

location ~* ^/TNG$ {
return 301 https://www.theirdomain.co.uk/TNG/index.php;
}

set $BOTH "";

# Does the case-insensitive pattern match?
if ( $request_uri ~* ^/TNG/index.php$ )
{
set $BOTH "${BOTH}1";
}

# Is it not an exact match to the correct case?
if ( $request_uri != /TNG/index.php )
{
set $BOTH "${BOTH}2";
}

# If both true, then redirect to the correct case
if ( $BOTH = 12 )
{
return 301 https://www.theirdomain.co.uk/TNG/index.php;
}
Categories
Uncategorized

Decrypt TP-Link config.bin backup file

Copy your config.bin file to linux then run this command to create a decrypted config.txt :

openssl enc -d -des-ecb -nopad -K 478DA50BF9E3D2CF -in config.bin > config.txt

Categories
Uncategorized

Choosing your own hosting and server type

In the past, I have paid £1000+vat a year for hosting to feed by hosting addiction.  This has whittled down in price over the years and now I’m paying just £42 inc vat!

Choosing the host type

  • Virtual Private Server (VPS)
  • Dedicated Server
  • Cloud VPS
  • Run on your home kit from your home broadband connection

Budget Hosting

Some good value providers in the UK are 123-reg.co.uk and UK2.net   I’ve been with both of them and had a few annoyances (switching my server off | Selling me hosting that was supposed to be maintained, but wasn’t | Me asking them to reboot the host and them saying that it wasn’t where is was supposed to be.  Me asking again… them saying it’s still not there and closing the call) over the years, but in all-in-all they’re worth the money.

However, this has become an absolute no-brainer very recently…  My new provider charge just £3.50 a month for SSD based VPS (mine feels super fast!)  www.vps.net

Premium Hosting

I have used a reseller account in the past and this had all sorts of features like a system for your users to manage their own accounts and resell too.  It all seemed a bit messy to me and eventually I’ve gone for managing it all myself with a few custom written scripts that do things perfectly.

I’ll expand this section as and when.