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
Crypto

Recovering from a wallet transfer mistake

The mistake

You sent money from Binance to another wallet, but chose the wrong network.

There are many options when transferring money around wallets and it’s quite tempting to choose the cheapest option, but that isn’t always right.  This example is where someone sent some USDT from their Binance wallet to what they thought was their USDT Wallet using the Blockchain app.  The user sent the money using Binance Smart Chain (BSC), but Blockchain.com do not support BSC.

LUCKILY, the Blockchain app allows you to view your private keys and even more luckily BSC is just a copy of ETH, so those private keys can be imported into a wallet that does support BSC.

Step 1 : Confirm you can actually recover from your mistake.

This is a lot of messing around, so make sure that you meet the recovery criteria before messing around.

You MUST meet both these conditions:

  1. You sent from Binance using BEP20 (BSC) to a ERC20 wallet.
  2. You have access to the private keys of the destination wallet (if not you might be able to raise a support request with your wallet provider).

Step 2 : Find your private key for your destination wallet

Warning: Never give your private keys to anyone.  Do not email them.  Do not store them unencrypted on the internet.

Examples of wallets where you can get to your private keys.

Blockchain Wallet (from Blockchain.com or the Blockchain app)
  •  Visit https://login.blockchain.com/ and login.
  • If you don’t know how, it’s really easy if you have a webcam on your PC/Mac, just choose “Login my mobile” and on the mobile app, use the top right menu option “Log in to Web Wallet”.
  • On the blockchain website, the far right settings icon has the option of Wallets and Addresses, pick that.
  • Click the Ethereum button
  • Click View your Private Keys.
Exodus Wallet

For Exodus wallet view this article

Step 3 : Install Metamask wallet

You can install this as a browser plug-in or Mobile app for Apple or Android

Go through the set-up procedure, secure your recovery key and maybe view the tutorial.  Note that the recovery key is only for the new wallet that Metamask creates for you when you install the app.

Step 4 : Import your private key into Metamask wallet

When viewing your wallet, click/press the circle above “Account 1” that looks like it could be a profile picture.  Choose “Import an Account” and paste your private key from Step 2 into it and then click “IMPORT”.

Step 5 : Add Binance Smart Chain network to Metamask wallet

Press/click the menu button on the top left, press Settings, scroll down and pick “Networks”, choose “Add Network” and enter the following:

Network Name: Binance Smart Chain
New RPC URL: https://bsc-dataseed.binance.org/
ChainID: 56
Symbol: BNB
Block Explorer URL: https://bscscan.com

Then click Add.

Note: To switch between Ethereum Network and Binance Smart Chain – just click the top of the app, where it says “Wallet”, you might need to scroll down to see the Binance Smart Chain.

Step 6 : Make sure Metamask is pointing the Network and Wallet

Make sure that you are now using the right Network and the imported wallet (Account 2)

Click/press the very top of the Metamask app where it says “Wallet Ethereum Main Network”.  Scroll down and choose “Binance Smart Chain”

Click the menu button on the top left and click on “Account 1” and choose “Account 2”.

Step 7 : Add your missing coin to the BSC wallet on Metamask

At the bottom of the Metamask wallet, click “+ADD TOKENS”.  Search for the token that you are missing (eg. USDT) and then click “ADD TOKEN”.

You might need to restart Metamask in order to see your balance.

Step 8 : Now get it to where you wanted it

There are a number of ways to do this, but the easiest is to send it back to Binance.  In Binance, when you look for your Deposit address, make sure that you pick BEP20 (BSC).

After you have done this, send it to the right place using the network that BOTH wallets support.

NOTE: this was quite complicated to work out, so if this helps you and you would like to send me a tip my wallets are:

BTC
1Gxjf2crehcSDRQh4dUkGD4wcg8AartTqm

ETH (ERC20 or BEP20)
0x918f8a5f3e2e7bd413f545a0c0a28dc3201f3a56

BNB (BEP2)
bnb136ns6lfw4zs5hg4n85vdthaad7hq5m4gtkgf23
Memo: 102292475

Categories
Crypto

Step by step first dip into crypto

Warning

Only put in money that you can afford to lose completely.  Crypto currencies are relatively new and a simple legislation change could make the price halve in a matter of minutes, an exchange could be hacked, or the exchange owner might disappear with all the assets.

Step 1 – Sign up at an exchange

The below are referral links that might give me a small tip or even both of us free BTC when you get around to depositing.

Binance is the main one that I use, and it is by far the cheapest.  Customer service is hard to get hold of if you have a problem.

Coinbase is probably the easiest exchange to use, but has high fees, a poor selection of coins to invest in and the spread (difference between buying and selling) is very wide.

Kucoin is another alternative that has a diverse range of investment options.

Poloniex is a good alternative with a clean look about it.

Step 2 – Provide identification & set up 2FA

It’s all good signing up, and they might even let you deposit, but the exchange might not let you withdraw until you have provided your ID.

Ensure that you set up 2 Factor Authentication, which is usually done using the Google Authenticator application.  Make sure you write down your recovery code and keep it somewhere very safe.  What you put into your account now might seem like not much, but in 5 years you might be crying if you cannot login.

Step 3 – Deposit using card or Faster Payments

It might be tempting to just go for the easy option of buying crypto with a card, but this simple option comes with a 2% fee.

A Faster Payments deposit is free, perhaps send a smaller amount on your first transfer, and then a spot trade has 0.1% fee.

Step 4 – Use 50% of your deposit  to buy the crypto that you are interested in

On the Binance menu, choose Trade > Convert, pick GBP from the top one, use half of what you have put in.  Not putting all your eggs in one basket is a good idea.  That goes for Exchanges too.

Step 5 – HODL (Hold On for Dear Life)

Waiting can yield some impressive gains, so do it.

Step 6 – BTD (Buy The Dip).

Warning: If it is just your coin that is plummeting you need to question whether this is a dip or a bad investment.

When there is a large dip, it’s time to spend some of that money that you have been holding back.  Use 10% of what you have left every time there’s a strong dip.  If it keeps going down, wait a week and buy some more!  If you run out of money, you are back to step 5.

My Investing

I have about 50% Bitcoin (BTC), 25% Ethereum (ETH) and then lots of other “gambles” on smaller coins either because I like the prospects, or because there is a current buzz (but get out quick on these).

On my smaller coins, I tend to sell 50% of a coin when the price doubles.  I like having the feeling that I’ve effectively got them for free.

After 1 month of my initial investment I was more than 50% down.  This lasted a long time and I stopped looking at it.  2 years later my investment was 2x.  Another year and it was over 5x (before the crash in 2017).  In Feb 2021, I withdrew 3x what I had invested over the years and still have well over 10x what I invested.  

Resources

https://coinmarketcap.com/ – the best resource for coin information.

https://www.cryptocompare.com/ – a good resource for coin information.

https://www.blockchaincenter.net/bitcoin-rainbow-chart/ – Bitcoin rainbow price chart.

https://alternative.me/crypto/fear-and-greed-index/ – Crypto fear and greed index.

Categories
Crypto

How to withdraw from Binance

A crypto currency investment can make you a lot of money very quickly, but it isn’t much good if you cannot convert into hard cash.

I have recently seen a post on Martin Lewis’s Facebook page and there were comments about people not knowing how to withdraw their investment.  So, here is an easy, step by step guide for Binance.

Binance

Log into the Binance website (not the mobile app).
Step 1 – Convert your Crypto currency into GBP
The first thing you need to do is to convert whatever crypto currency that you want to withdraw into GBP.
The easiest way to do this is to choose the option from the top Trade->Convert.  Choose BTC in the top box, GBP in the bottom box and then click the “MAX” option and you can then preview your sale before confirming it.  If this works for you, jump to Step 2.
Depending on which crypto currency you own, you might not be able to do this.  You need to swap it for GBP, but Binance might not support that market pair.  So you might need to swap to an intermediary currency first (BTC and BNB is swappable with most currencies)
To swap one currency for another – this example is BTC to GBP.
  1.  Choose Trade -> Classic
  2. On the upper right there is a search box, enter BTCGBP and it will show BTC/GBP under it – click that.
  3. Scroll down to where it shows Buy BTC and Sell BTC.  You want to Sell BTC for GBP, so you will be using the right side boxes.
  4. Just above the boxes, but to the left of the screen, there are options for “Limit”, “Market” and “Stop-Limit”. Using the “Market” rate simplifies the process and means you will get a sale now.  If you want an idea of how much you might get, try using the “Limit” option first and it will tell you.  You can then switch back to “Market”.  If you click sell when you have chosen “Limit”, you might create an order that is trying to sell at more than the market is willing to buy at, which might not get filled.  If this happens your currency is “locked” until you release the trade by cancelling it.
  5. After you have chosen “Market”, in the Sell section on the right, there is a bar with blobs on it which lets you easily select how much you want to sell.  So click one of the blobs and adjust it to how much you want to sell.
  6. Click the red Sell Button and some some boxes will flash up the screen saying “Order Created” and “Order Filled”.
  7. Click the “Trade History” option that is a bit lower on the screen and you will see how much you got and what fee you paid.
  8. Click on Wallet -> Fiat and Spot to see how much you now have in your GBP wallet.
Step 2 – Withdraw your GBP
  1. Click Wallet -> Fiat and Spot
  2. Under the GBP asset, click the Withdraw link.
  3. Choose which ever option is cheaper – Faster Payments £1.50 fee, or payment to card at 1% fee.
  4. If you want to withdraw it all, just click on the number what it says is available and it will fill it in for you.
  5. Continue…
Categories
Crypto

How to withdraw from Coinbase

A crypto currency investment can make you a lot of money very quickly, but it isn’t much good if you cannot convert into hard cash.

I have recently seen a post on Martin Lewis’s Facebook page and there were comments about people not knowing how to withdraw their investment.  So, here is an easy, step by step guide for Coinbase.

Coinbase

Log into the Coinbase website (not the mobile app).
Step 1 – Convert your Crypto currency into GBP
The first thing you need to do is to convert whatever crypto currency that you want to withdraw into GBP.
  1. Click Portfolio, select the currency.  On this screen you are looking at the contents of your “wallet” you can only add/remove funds in that currency.  eg. sending money from your BTC Wallet on Coinbase to your BTC Wallet on Binance
  2. Click Overview. Now you can see Buy/Sell options.  This allows you to swap one currency for another.
  3. Choose the Sell option for your currency, depositing to your GBP wallet.
Step 2 – Withdraw your GBP
  1. Click Portfolio
  2. Select the GBP asset
  3. Choose withdraw
  4. Withdraw all
  5. Continue…
Categories
Docker Plex

Fix poor quality video in Plex under docker

I’ve recently moved servers and instead of managing my own Plex install, I decided to go with the a docker install.  It took seconds to sort out and I was very happy with it.  That was until I enabled remote access.  Suddenly, all my videos looks started looking terrible quality.

This has been resolved by going to Dashboard -> Settings -> Network and under “Lan Networks” adding the values “172.18.0.0/16,192.168.0.0/24,127.0.0.1″ (without the quotes).

You will need to work out your own values.

To work out the subnet for the plex container:

    $ docker network inspect plex_default|grep Subnet
                     "Subnet": "172.18.0.0/16",

To work out the subnet for your local network (in the majority of cases),

     $ hostname -I | awk '{print $1}'
    192.168.0.25

So, this needs to be : 192.168.0.0/24

Categories
Docker

Using an APEMAN C450 Dash Cam as a security camera with ZoneMinder using Docker

Just plug the APEMAN C450 dash camera into your Linux server via USB and select “PC Camera” using the buttons on the side.

Confirm it works with this command:
ffmpeg -f video4linux2 -s 640x480 -i /dev/video0 -ss 0:0:2 -frames 1 /tmp/out.jpg

Then download this docker-compose config file
https://github.com/dlandon/zoneminder/blob/master/docker-compose.yaml

Add the video device to the docker-compose.yaml file:
devices:
- /dev/video0:/dev/video0

Install/start your docker container:
docker-compose up -d

Then visit the freshly installed system on whatever your IP address that you have configured:
https://192.168.0.25:8443/zm/

To add the dash camera as a monitor :
General Tab:
Source Type = Local
Source Tab:
Source Path = /dev/video0
1280 x 720

Note that, when I first set this up recording, I was getting a corrupt/ green frame of video at the beginning of the recording.  Whatever was causing this made it trigger an event constantly.  To fix this, I went into the settings for /dev/video0, buffer tab and changed Alarm frame count from 1 to 3

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
Plex

Unable to log into Plex Web View

So, I was tinkering with the Plex Media Server settings and then suddenly I got this error in Chrome from my desktop.

“Plex didn’t send any data”

“ERR_EMPTY_RESPONSE”

Visiting my server from https://plex.tv/web worked – really weird.

So, going back over what changes I had made, I found the culprit.

Under the Plex Settings > Settings > Network menu option, I had modified the IP6 “Secure Connections” from “Preferred” to “Required”.  I changed this back to Preferred and that immediately fixed my issue and the web view was working again.

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