Jump to content

Recommended Posts

Posted (edited)

lite.png.a6cb33e7b377f70b8479dd85fc0e36fb.png

PrestaShop Module: Security Lite

With this module the risk of getting hacked is decreased. You should always care about security. By using this module, you add another layer of security to your PrestaShop website, that will benefit you in case someone tries to get unauthorized access.

I did not add settings that are obviously already covered by PrestaShop core with another technique, but when that it said, if some technique having more layers is good practice, I added those extra layers of security.
 

Here are the features you will have with this FREE module:

  • Brute force protection
  • Ban IP’s
  • Fix insecure permissions
  • Disable right click
  • Check system for vulnerabilities
 
Download it here (v. 2.0.0): securitylite.zip
Build to work with PrestaShop 1.7.0.0+
Documentation:
 
Thank you @zapalm for your suggestion.

This module use no overrides and passes PrestaShop's Validator.

1.thumb.jpg.4b37765e55fb5a8ed07628ce16948168.jpg

2.thumb.jpg.748e6e8e0ce57ca3ac614ae0b6b4af81.jpg

3.thumb.jpg.1bfc1c50b34f5424ea67b0e61b776470.jpg

4.thumb.jpg.64dea059e06e0338bce882e7b4a96843.jpg

5.thumb.jpg.5849e1e8b1165109ed7d4632f2000864.jpg

6.thumb.jpg.5c732fbd8184e23fa85053a1967ae35d.jpg

7.thumb.jpg.7569e4bd6e24b1230e4eb788267a6a91.jpg

8.thumb.jpg.93bf38662048a3d0908ad397fd368a6a.jpg

9.thumb.jpg.bb1a4648446702329e96d679a51d08b6.jpg

10.thumb.jpg.8d304e5416fd3c80c5e0c3d69db8d7b0.jpg

11.thumb.jpg.af6cc55d56b9b350c83b373b39522c22.jpg

 

13.thumb.png.a152e1dde2c00edf1dee924f668e08ae.png

 

I advise you to read the documentation, because some settings might need a little explanation. If you have any questions, do not hesitate to contact me. Let's be safe!

Edited by shinetech.dk
added new version of module. (see edit history)
  • Thanks 1

Share this post


Link to post
Share on other sites

If you have suggestions for new features, please let me know in a comment. 😀

Share this post


Link to post
Share on other sites
Posted (edited)

Hello.

I have review your module a little and I have an advice for an improvement and a report for an issue.

1. Will be good, if you add to your free version of the module the functionality to check security vulnerabilities that are known from CVE. This is my free and open-source library, that you can use on your free and paid module versions both: Security vulnerability checker :)

2. In your SecurityLite::getContent() method there is an issue. Every loading of the module settings page, your module clear the system cache ;)

    public function getContent()
    {
        $output = null;

        if ((bool) Tools::isSubmit('submitSecurityLiteModule')) { ... }

        return $output . $this->renderForm() . $this->checkSystem() . $this->securityPro() . $this->clearCache();
    }
    public function clearCache()
    {
        Tools::clearSmartyCache();
        Tools::clearXMLCache();
        Media::clearCache();
        Tools::generateIndex();
    }

 

Edited by zapalm
Fixed a typo (see edit history)

Share this post


Link to post
Share on other sites
Posted (edited)
5 hours ago, zapalm said:

Hello.

I have review your module a little and I have an advice for an improvement and a report for an issue.

1. Will be good, if you add to your free version of the module the functionality to check security vulnerabilities that are known from CVE. This is my free and open-source library, that you can use on your free and paid module versions both: Security vulnerability checker :)

2. In your SecurityLite::getContent() method there is an issue. Every loading of the module settings page, your module clear the system cache ;)


    public function getContent()
    {
        $output = null;

        if ((bool) Tools::isSubmit('submitSecurityLiteModule')) { ... }

        return $output . $this->renderForm() . $this->checkSystem() . $this->securityPro() . $this->clearCache();
    }

    public function clearCache()
    {
        Tools::clearSmartyCache();
        Tools::clearXMLCache();
        Media::clearCache();
        Tools::generateIndex();
    }

 

 

zapalm Your module error
 
[PrestaShop] Fatal error in module file :/home/.../../classes/module/Module.php(1361) : eval()'d code:
syntax error, unexpected 'zapalm' (T_STRING), expecting \\ (T_NS_SEPARATOR)

PS 1.6.1.23

Edited by TCHOUPI (see edit history)

Share this post


Link to post
Share on other sites

@zapalm Thank you.

1) I included your suggestions and made a fix for CVE-2018-7491.

2) You are right, it is superfluous to clear the case.

@TCHOUPI You can't install @zapalm's library as a module, it is a script. Btw. I included the checks in my module.
 

  • Like 1

Share this post


Link to post
Share on other sites
13 hours ago, shinetech.dk said:

@zapalm Thank you.

1) I included your suggestions and made a fix for CVE-2018-7491.

2) You are right, it is superfluous to clear the case.

@TCHOUPI You can't install @zapalm's library as a module, it is a script. Btw. I included the checks in my module.
 

ok thanks you, for ps 16 it can work ?
 

Share this post


Link to post
Share on other sites
14 hours ago, shinetech.dk said:

1) I included your suggestions and made a fix for CVE-2018-7491.

Advice for you for the future work :) You lose the benefits if you copy the library's code into your module. The best way is using Composer to keep up to date the library and get new vulnerability checks ;)

Share this post


Link to post
Share on other sites
22 minutes ago, zapalm said:

Advice for you for the future work :) You lose the benefits if you copy the library's code into your module. The best way is using Composer to keep up to date the library and get new vulnerability checks ;)

I had to refactor your functions. Also I don't want to include the checks for 1.6. :-)

Share this post


Link to post
Share on other sites
2 hours ago, shinetech.dk said:

The module works with 1.7+ only, sorry.

ok Thanks you my friend

Share this post


Link to post
Share on other sites

Hi, wanted to try the module, PS 1.7.5.1, debug enabled, see the image pls. What exactly does it mean?

security_lite.png

Share this post


Link to post
Share on other sites

mr_absinthe, your server settings is not right configured.

You need to go to your php.ini file and look for allow_url_fopen. The value of this PHP configuration should be "On".

allow_url_fopen = On

Allow_url_fopen is required when you use PrestaShop.

If you don't know how, you can ask your hosting to change the value for you.

Share this post


Link to post
Share on other sites

That is exactly what I have in php.ini. Cache cleared, browser and PS. Still the same.

Share this post


Link to post
Share on other sites

Can you try to restart your server? Do you have any files overriding your php.ini file?

Share this post


Link to post
Share on other sites
Posted (edited)

Server rebooted. Still the same. No I don't have any overrides related to php.ini as far as I know. Resetting module didn't help either.

Edited by mr_absinthe (see edit history)

Share this post


Link to post
Share on other sites
10 minutes ago, mr_absinthe said:

Server rebooted. Still the same. No I don't have any overrides related to php.ini as far as I know. Resetting module didn't help either.

Weird.

I managed to reproduce the warning with "allow_url_fopen = Off". I made a refractory of my code to make it work with the setting off.

I will release new version tonight.

Share this post


Link to post
Share on other sites
Posted (edited)
5 minutes ago, mr_absinthe said:

Weird is that I have


allow_url_fopen = On

Yes, it is weird that you get the warning with allow_url_fopen = On

But don't worry. I fixed it on my dev version. I will release a new version very soon.

Edited by shinetech.dk (see edit history)

Share this post


Link to post
Share on other sites

@mr_absinthe I just uploaded a new version, please give it a try. It should fix your warning. 🙂

Share this post


Link to post
Share on other sites

Seems to be working fine, on my test server at the moment 😉 Will go for PRO version if there will be some kind of discount available in the near future. Is your "file changes" section checking for Size | Permissions {File | Group | Owner} | Time | Stamp ?

Share this post


Link to post
Share on other sites
44 minutes ago, mr_absinthe said:

Seems to be working fine, on my test server at the moment 😉 Will go for PRO version if there will be some kind of discount available in the near future. Is your "file changes" section checking for Size | Permissions {File | Group | Owner} | Time | Stamp ? 

The file changes will send you an e-mail with all files changes since last check. You decide how often you want to check. You set that interval in a cron-job. In the e-mail you will get a full path to the changed files. The file changes works by comparing a hash. 🙂

Share this post


Link to post
Share on other sites

There will be a discount period when next release of PRO version get released. I release a new version this week with new PRO features.

Share this post


Link to post
Share on other sites

OK, if you will be sending a discount code, please let me have one as the current price is rather steep.

Share this post


Link to post
Share on other sites

What about the umask issue in core PrestaShop that converts new module directories to 0777 once they get uploaded?

Share this post


Link to post
Share on other sites
Posted (edited)
15 minutes ago, tapanda.gr said:

What about the umask issue in core PrestaShop that converts new module directories to 0777 once they get uploaded?

It is already solved. click on the tab "Permissions" then enable the features and "Save". This will run a script that fix all permissions on your PrestaShop website. Repeat this everytime you install a module.

image.png.f37af2627864200cec0bfc23f3b9ad14.png

 

It is overkill to hook this script or set it up as a cronjob. Lets keep the module lightweight so it does not affect your shops performance.

Edited by MathiasReker (see edit history)

Share this post


Link to post
Share on other sites

Hi I have this error when I try to configure the module.
The installation went ok, the configuration doesn't work.

[Tue Jul 23 10:26:39.988752 2019] [fcgid:warn] [pid 11106] [client 83.224.157.129:52003] mod_fcgid: stderr: PHP Fatal error:  Call to undefined method SecurityLite::displayInformation() in /var/www/clients/client6/web114/web/modules/securitylite/securitylite.php on line 86, referer: https://*************.it/************/index.php/module/manage?_token=QmCkpOIcZKEgO5smDIgcI9RnYFw-qSn1c2z466iYRkA

[Tue Jul 23 10:26:39.988844 2019] [fcgid:warn] [pid 11106] [client 83.224.157.129:52003] mod_fcgid: stderr: #2 /var/www/clients/client6/web114/web/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php(668): Symfony\\Component\\Debug\\ErrorHandler->handleException(Object(Symfony in /var/www/clients/client6/web114/web/app/bootstrap.php.cache on line 3231, referer: https://********.it/***********/index.php/module/manage?_token=QmCkpOIcZKEgO5smDIgcI9RnYFw-qSn1c2z466iYRkA

Thanks in advance
 

Share this post


Link to post
Share on other sites
7 minutes ago, linoolmostudio said:

Hi I have this error when I try to configure the module.
The installation went ok, the configuration doesn't work.

[Tue Jul 23 10:26:39.988752 2019] [fcgid:warn] [pid 11106] [client 83.224.157.129:52003] mod_fcgid: stderr: PHP Fatal error:  Call to undefined method SecurityLite::displayInformation() in /var/www/clients/client6/web114/web/modules/securitylite/securitylite.php on line 86, referer: https://*************.it/************/index.php/module/manage?_token=QmCkpOIcZKEgO5smDIgcI9RnYFw-qSn1c2z466iYRkA

[Tue Jul 23 10:26:39.988844 2019] [fcgid:warn] [pid 11106] [client 83.224.157.129:52003] mod_fcgid: stderr: #2 /var/www/clients/client6/web114/web/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php(668): Symfony\\Component\\Debug\\ErrorHandler->handleException(Object(Symfony in /var/www/clients/client6/web114/web/app/bootstrap.php.cache on line 3231, referer: https://********.it/***********/index.php/module/manage?_token=QmCkpOIcZKEgO5smDIgcI9RnYFw-qSn1c2z466iYRkA

Thanks in advance
 

What is your PrestaShop version and your PHP version?

Share this post


Link to post
Share on other sites

@linoolmostudio I did not manage to reproduce your warning. Can you send me a copy of your htaccess file in a private message?

Share this post


Link to post
Share on other sites
21 minutes ago, MathiasReker said:

@linoolmostudio I did not manage to reproduce your warning. Can you send me a copy of your htaccess file in a private message?

Just sent a private message.
thx :)

Share this post


Link to post
Share on other sites
4 minutes ago, linoolmostudio said:

Just sent a private message.
thx :)

I send a msg. I think it should be solve by that solution. If you need anymore help, please let me know  🙂

Share this post


Link to post
Share on other sites

Hello Mathias,

 

This link doesn't work:

Download it here (v. 2.0.0): securitylite.zip

Do you have another alternative link to download it?

Thanks,

 

Share this post


Link to post
Share on other sites

Thanks Mathias,
Now both links are working.

Do you have a discount code to buy a security pro?

Regards,

Marcos

Share this post


Link to post
Share on other sites

Hello Marcos,

The price is already adjusted, so everyone gets the discount.

You can buy the module here: https://addons.prestashop.com/en/website-security-access/44413-security-pro.html

Best regards

Mathias

 

Share this post


Link to post
Share on other sites

New Pro version released: https://addons.prestashop.com/en/website-security-access/44413-security-pro.html

Share this post


Link to post
Share on other sites

Hi,
does your module support range IP block? If so, do I use 192.168.0.* or 192.168.0.1/24? Also, are blocked IPs listed in searchable table?

Share this post


Link to post
Share on other sites
On 9/4/2019 at 2:50 PM, mr_absinthe said:

Hi,
does your module support range IP block? If so, do I use 192.168.0.* or 192.168.0.1/24? Also, are blocked IPs listed in searchable table?

Maybe I will support IP range in next version. Are you on free or pro version?

Share this post


Link to post
Share on other sites
3 minutes ago, mr_absinthe said:

Currently trying the free version

Okay. I will see how much work it takes. Maybe I will include IP ranges.

Share this post


Link to post
Share on other sites

sorry to disturb you.


same problem as linoolmostudio
The installation went fine, fatal error in configuration.

PrestaShop version: 1.7.2.4
security lite: 2.00

best regards

Share this post


Link to post
Share on other sites
15 minutes ago, larrson said:

sorry to disturb you.


same problem as linoolmostudio
The installation went fine, fatal error in configuration.

PrestaShop version: 1.7.2.4
security lite: 2.00

best regards

Can you send me a screenshot, then I will get a clue how to fix it, because I am not able to reproduce the error.

 

Share this post


Link to post
Share on other sites
20 hours ago, MathiasReker said:

Okay. I will see how much work it takes. Maybe I will include IP ranges.

That would be certainly good feature to have, also if those banned IPs are listed below each other, such as:

123.12.12.11

123.11.11.13

etc. so we can search them unlike it is done on the maintenance settings.

On my two servers, I noticed "Some features in Security Pro might not work on your setup, because your .htaccess file is not used! (Apache)" however on both the .htaccess is present in root.

Share this post


Link to post
Share on other sites
1 minute ago, mr_absinthe said:

That would be certainly good feature to have, also if those banned IPs are listed below each other, such as:

123.12.12.11

123.11.11.13

etc. so we can search them unlike it is done on the maintenance settings.

On my two servers, I noticed "Some features in Security Pro might not work on your setup, because your .htaccess file is not used! (Apache)" however on both the .htaccess is present in root.

Are you on a Apache, nginx or litespeed?

Share this post


Link to post
Share on other sites

first one:

Server information Linux #1 SMP Tue May 14 21:24:32 UTC 2019 x86_64

Server software version: Apache, PHP version: 7.2.22

second one:

Apache, CGI with Apache Worker or another webserver, PHP version: 7.2.22

Both running PrestaShop version: 1.7.6.1

Edited by mr_absinthe (see edit history)

Share this post


Link to post
Share on other sites
4 minutes ago, mr_absinthe said:

first one:

Server information Linux #1 SMP Tue May 14 21:24:32 UTC 2019 x86_64

Server software version: Apache, PHP version: 7.2.22

second one:

Apache, CGI with Apache Worker or another webserver, PHP version: 7.2.22

Both running PrestaShop version: 1.7.6.1

Can you try to clear your cache and check if that message is still displayed?

Share this post


Link to post
Share on other sites
1 minute ago, mr_absinthe said:

Cache cleared browser + ps and it is still the same on both.

Okay, I will make some additional checks. I release a new version soon :)

Share this post


Link to post
Share on other sites
37 minutes ago, larrson said:

sorry to disturb you.


same problem as linoolmostudio
The installation went fine, fatal error in configuration.

PrestaShop version: 1.7.2.4
security lite: 2.00

best regards

It might be, that your htaccess file is not writeable. Can you please check?

Share this post


Link to post
Share on other sites
8 hours ago, MathiasReker said:

It might be, that your htaccess file is not writeable. Can you please check?

Unfortunately, it's still doesn't work. I tried everything. 0655, 0755, and even 0777.

best regards

Share this post


Link to post
Share on other sites

Just to let you know, if I enable Debug mode and run on PS v 1.7.5.1 and security lite: 2.00 I receive this error popup:

Warning on line 159 in file /home/xsxsxsxsxs/public_html/modules/securitylite/securitylite.php
[2] chmod(): Operation not permitted
 

Share this post


Link to post
Share on other sites
2 hours ago, mr_absinthe said:

Just to let you know, if I enable Debug mode and run on PS v 1.7.5.1 and security lite: 2.00 I receive this error popup:

Warning on line 159 in file /home/xsxsxsxsxs/public_html/modules/securitylite/securitylite.php
[2] chmod(): Operation not permitted
 

You get this error because you do not have permission to use chmod(). Ask your hosting administrator to grant you that permission.

Share this post


Link to post
Share on other sites
On 9/12/2019 at 10:05 PM, larrson said:

Unfortunately, it's still doesn't work. I tried everything. 0655, 0755, and even 0777.

best regards

Please send me a screenshot of the error.

Share this post


Link to post
Share on other sites

As a test, I have manually changed permissions an a directory to 777 using FileZilla. With debug disabled, I run the fix using your module, permissions are changed back to 755 and success message "Permissions updated!" is received. Do you still think that I do not have permission to use chmod()?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More