[How-to] CSF Support in Hestia CP

Hello @martineliascz ,thanks for this tutorial and the add on !

Your tutorial was clear and precise I 've been able to add CSF to my Hestia panel in no time !

I know this topic is old, and my question may be stupid (I am totally new to Hestia, I used to work with goPanel but as it is mac only I would rather use a cPanel like Hestia for my new servers …) ,

following your instruction I have been able to add several custom link and widget to the header nav bar (now the nav bar is totally something else than what is default haha) to have a quick access to my favorite tab (pretty much same stuff than you did by adding the CSF tab)

My question : how can I make it that it will “survive” the updates of Hestia, because I am guessing when Hestia will update it will erase those html changes …

i am running Hestia v1.4.17 on ubuntu 20.04
thanks in advance !

1 Like

No it will not …

Somebody need to develop something like this…

1 Like

@gaetan-x Hi, thanks for the comment. Could you please show us how your nav bar looks like? I’m curious… love inspiration :slightly_smiling_face:

@eris
@martineliascz

For preserve CSF button with HestiaCP updates, next code can be placed to /etc/hestiacp/hooks/post_install.sh

#!/usr/bin/env bash

# panel template update
cd /usr/local/hestia/web/templates/includes
[[ -n $(grep '<!-- Customized -->' panel.html) ]] && exit 1
cp panel.html panel.html-bkp-script
sed -z -i -E 's#<!-- *Statistics tab *-->#<!-- Customized -->\n<div class="l-menu__item <?php if($TAB == "CSF" ) echo "l-menu__item--active" ?>"><a href="/list/csf/"><i class="fas fa-shield-alt"></i>\&nbsp;<?=_("CSF");?></a></div>\n<!-- Statistics tab -->#' panel.html
2 Likes

@ww7 Thanks for this tuto!

Anyway, calling sed twice is not needed, you could just use regex replace, such as simple “.”.

Thanks and take care!

Martin

Instead '.' updated with ' *' (also can be '[ ]*'), means any number of whitespaces

@martineliascz Thank you for great threads for HestiaCP!

@ww7 You’re welcome!

Hestia CP is still the best CP out there. I’m using it on all of my Debian servers…

I’m now working on many projects in parallel, so hopefully I’ll find some time in the future to contribute once again…

Martin

Hello Martin ! I have no experience with CSF, can you tell me a couple of advantages of CSF over firewallD and Fail2ban?
I would like to know and try CSF.
Thanks !

Hi @Eduardo - please check my previous post why I do prefer the CSF over stock firewall.

Anyway, @Lupu and others did a very great job with implementing some of the CSF features, such as the ipset blocking to the Hestia CP while preserving the simplicity of stock firewall.

Thanks and take care!

Martin

3 Likes

Hello,

In the newer version the template path which needs to be edited is /usr/local/hestia/web/templates/includes/panel.html instead.

Also, to make it look consistent with the Hestia CP design, a little fa icon wouldn’t hurt -

<div class="l-menu__item <?php if($TAB == 'CSF' ) echo 'l-menu__item--active' ?>"><a href="/list/csf/"><i class="fas fa-shield-alt panel-icon"></i><?=_('CSF')?></a></div>

Thanks

2 Likes

Hi @indianets and welcome to the forum!

I’ll soon install the latest Hestia CP and update the tutorial accordingly as I will have some free time this year.

Thanks too!

5 Likes

I’m a fan of CSF and it should come as standard on HestiaCP!!!

I’ve been using CSF and Fail2ban for a long time without problems.

To do this, just disable the SSH protection in Fail2ban so as not to conflict with the CSF.

sed -i -e 's/port    = ssh/enable  = false\nport    = ssh/' /etc/fail2ban/jail.conf;
service fail2ban restart;
service fail2ban status

In these links you have a good read on this subject:
https://www.digitalfaq.com/guides/webhosting/install-fail2ban-cpanel-pt1.htm
https://www.digitalfaq.com/guides/webhosting/install-fail2ban-cpanel-pt2.htm

1 Like

what is the status of this, does the guide working with latest version?

thanks

@bubblecatcher For now you can use my steps and a mix of @indianets. Thanks!

*** as of today, HestiaTeam is not providing any supporting yet for CSF, due to strong reasons behind there…

But there are ways to have it working within hestia UI…

ref: How to install CSF on Hestiacp web ui [config firewall] | Guest Blog Posting

hestia-csf

Just run this below command as ROOT user from your linux terminal. (Tested with Hestia v1.7.3 * Ubuntu 20.x)

wget https://raw.githubusercontent.com/vvcares/hestia/master/hestia_csf_install.sh && bash hestia_csf_install.sh

The above command will do as below:

  1. Download the script from vvcares-github repo
  2. It will check if there is an existing CSF installation in ‘/etc/csf/’.
  3. If exists, it will proceed to Step#5
  4. If not exist, it will install fresh/new CSF firewall
  5. It will automatically add the hestiacp backend port into ‘CSF.CONF > TCP_IN’
  6. Create an additional folder called ‘csf folder’ inside ‘/usr/local/hestia/web/list/’
  7. Add the CSF link button into your ‘hestiacp panel > in main admin dashboard only’ & Exit.

It is important to note that CSF should not be your only line of defense for securing your server. You should also follow best practices for server security, such as keeping your server software up-to-date, using strong passwords, and limiting access to only necessary users and services.

3 Likes

Due to strong reasons behind there what?

I haven’t explored CSF since few years. Is there anything a user should be concerned about before trying CSF?

CSF has lot of unique settings can filter/blocking etc.,
commercial server, Im using this combo for few years.

If the team supports for CSF, there will be tons of questions will arise & have to spend time for troubleshooting for a 3rd party’s application.

3 Likes

Hello! Can you update the Blog link?

The Github link is also broken.

Hi, its working well.
I tried just now both to VVCARES.COM & GITHUB. Both are working well…

Oops. The Github link is ok. I copied the wrong link here.

The Blog does not have a broken link. It’s Cloudflare blocking access.

Your script is perfect!!! It worked here with Debian 11 and hesciaCP v1.8.11 :+1:

Do you disable fail2ban to use CSF :question: