GN Latest News

Run the EHCP force Post-install Scripts. (Important)

Configure your router.
Install software on your PC to remotely access your server.
Run the EHCP force Pre-install Script. (Important)
Install EHCP Force.
Run the EHCP force Post-install Scripts. (Important)
Post Reply
Rob Swan
Site Admin
Posts: 76
Joined: Tue Oct 31, 2017 3:03 pm
Location: UK
Contact:

Run the EHCP force Post-install Scripts. (Important)

Post by Rob Swan »

There are two issues we need to fix with our installation of EHCP force, the first one being SMTP auth, and the second is Fail2ban.

Again, this is because EHCP force has not yet been updated to work on Ubuntu 24.04.

If and when EHCP force does get updated this post will most likely be deleted.

Put simply without SMTP auth working you will not be able to send any emails.

So, to fix these issues I have two more scripts.

So, let’s get started.

How to download the scripts.
Connect to your serve using your PC and PuTTY.

It is essential we are in your user’s home folder, so just to be sure enter this command first

cd ~

Image

Ok, in order to download the two scripts, enter these commands.

wget https://downloads.ghostnetwork.co.uk/scripts/ehcpforce/2404/smtpauthfixv2.sh

wget https://downloads.ghostnetwork.co.uk/scripts/ehcpforce/2404/f2bfixv2.sh

Image

Image

Image

Image

Next, give them both permission to execute by entering these commands.

sudo chmod +x smtpauthfixv2.sh

sudo chmod +x f2bfixv2.sh

Image

Image

Running the SMTP auth fix.
As the filename may suggest this is version 2 of my script, this new version will fix saslauthd which is used from SMTP auth (sending emails).

The old script used to remove saslauthd and replace it with with something called the Courier authdaemon for SMTP auth instead.

Where the he Courier authdaemon method is very good, fixing saslauthd is better as it is what the developer of EHCP force designed his application to use.

Its ok to run this script even if you already ran the old one, as it will just undo the work that the old script did.

Run the first script with this command.

sudo bash smtpauthfixv2.sh

Image

If everything goes to plan, this is what you should see.

Image

The script first tests the saslauthd service, and then assuming it is not working it performs the required fixes. Finally it should report that the script was successful to the user.

Note: It is possible that EHCP force update my stop SMTP auth from working by resetting the configuration, if affected you can run the script again by using the same command (sudo bash smtpauthfixv2.sh).

Issues that may occur with the SMTP auth fix Script.
The chances are, you will not have any problems with the script, however if you do here are some of the things that can go wrong.

1. The apt system is locked out by another process.
On some very rare occasions there can be a problem where the new script appears to get stuck, this is a problem with the apt system getting locked out by another process, it is very rare though.

Please allow at least 8 minutes before you take any action.

If after about 8 minutes the script still has not completed, you can press control and z to stop the script, then reboot your server using this command.

sudo shutdown -r now (only run this command, if you have problems, as above)

When the system reboots, again using PuTTY enter this command.

sudo dpkg --configure -a (only run this command, if you have problems, as above)

The system should then tell you what the problem is.

If it asks you about a configuration file, you should select the appropriate option to keep the existing file, then run the script again.

2. The saslauthd service is already running.
If the script tells you that SMTP is ok, it probably means that EHCP force has been updated and fixed.

If the script tells you SMTP auth is ok, but you still find you are unable to send emails, then you can run the script again in “force” mode. This will force to script to fix SMTP auth even though saslauthd appears to be ok, to do this use this command in PuTTY.

sudo bash smtpauthfixv2.sh force (only run this command, if you have problems, as above)

3. An unknown error with SMTP auth.
There is a very high probability that the script will have no problem fixing SMTP auth, however if the script does not fix it, as a last resort you can run the script in “courier” mode. This would mean that the script would resort to the Courier authdaemon, and remove saslauthd from your server. To run the script in Courier authdaemon mode, enter this command in PuTTY.

sudo bash smtpauthfixv2.sh courier (only run this command, if you have problems, as above)

Running the Fail2ban fix.
Fail2ban requires an application called Python to run. The default version of Python for ubuntu 24.04 is v3.12, which is not currently compatible with the latest Ubuntu package version of Fail2ban. The good news is that a version has been written that will work.

My Script simply upgrades Fail2ban to the new version, thus fixing our issue, it also changes the main Fail2ban configuration file so that it works with Ubuntu 24.04.

Make the PuTTY window about double the size (drag the corner out with your mouse).

Run the second script with this command.

sudo bash f2bfixv2.sh

As the filename may suggest this is version 2 of my script.

Image

Image

If you server takes a few minutes to move on from the above screen, don’t worry this is normal.

Image

When the script finally finishes you can close PuTTY with this command.

exit

Issues that may occur with the Fail2ban Script
The chances are, you will not have any problems with the script, however if you do here are some of the things that can go wrong.

1. One of the files needed fails to download.
In most cases this is not a problem as the script has an alternative download site, should the main site download fail, you may see something like this.

Image

In the above example the script still successfully completed.

If both download options fail (should never happen), you will may see something like this.

Image

If this does happen, then just try again later, and keep trying until the script completes successfully.

2. The script just cannot fix Fail2ban.
Again, this should never happen, but the script does check the Fail2ban service after the fix to make sure all is good.

So, if the script does not fix Fail2ban, then you may see something like this.

Image

In this situation, it hard to suggest a fix, however you could try uninstalling Fail2ban and trying again.

The commands to unistall fail2ban are:- (answer yes to each of the prompts)

sudo apt-get remove fail2ban (only do this, if you have a problem as above)

sudo apt-get purge fail2ban (only do this, if you have a problem as above)

sudo rm -R /etc/fail2ban (only do this, if you have a problem as above)

sudo apt-get autoremove (only do this, if you have a problem as above)

sudo shutdown -r now (only do this, if you have a problem as above)

You can the re-run the script using sudo bash f2bfixv2.sh

3. There is a problem with EHCP force.
To script requires that EHCP force is installed and working to run, so if there is a problem with EHCP force you may see this.

Image

Anyway, We are all done here.
Post Reply