Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 1 votes

PHP Intrusion Detection System for osCommerce


243 replies to this topic

#41 dink

  • Community Member
  • 48 posts
  • Real Name:dink
  • Gender:Not Telling

Posted 16 May 2010, 06:39

View Postcelextel, on 16 May 2010, 06:20, said:

Avoid giving the full path info to the files.

Either you do not have the following file:
catalog\includes\classes\currencies.php

or the following function is missing in the catalog\includes\classes\currencies.php file:
    function calculate_price($products_price, $products_tax, $quantity = 1) {
      global $currency;

      return tep_round(tep_add_tax($products_price, $products_tax), $this->currencies[$currency]['decimal_places']) * $quantity;
    }




You should setup osCommerce directly in the root directory of your website or in the catalog directory. You have setup under store\catalog\. This is not usually done.


Thank you so much!
I did not have the function in the currencies.php so I added your code and everything works fine now.
I agree with you about the setup. I am trying out a new hosting provider and it automatically installed the application.
Is it possible to move the setup by just moving the files to the root?
dink

#42 celextel

  • Community Member
  • 136 posts
  • Real Name:Lakshmanan S.
  • Location:Chennai

Posted 16 May 2010, 06:53

View Postdink, on 16 May 2010, 06:39, said:

Thank you so much!
I did not have the function in the currencies.php so I added your code and everything works fine now.
I agree with you about the setup. I am trying out a new hosting provider and it automatically installed the application.
Is it possible to move the setup by just moving the files to the root?
dink

Glad to know about this.

Yes, you could move all the shop files and directories to the root. After completing the move, you have to change the path and URL info in the following two files:
includes/configure.php
admin/includes/configure.php


#43 kramster

  • Community Member
  • 10 posts
  • Real Name:Mark Watson
  • Gender:Male
  • Location:Sydney, Australia

Posted 17 May 2010, 08:06

I've just installed PHPIDS and when I try the first test I get this error:

Fatal error: Class 'PDO' not found in /home/ior49618/public_html/catalog/includes/phpids/lib/IDS/Log/Database.php on line 170

I have followed the instructions step-by-step. Can you help please?

#44 celextel

  • Community Member
  • 136 posts
  • Real Name:Lakshmanan S.
  • Location:Chennai

Posted 17 May 2010, 08:28

View Postkramster, on 17 May 2010, 08:06, said:

I've just installed PHPIDS and when I try the first test I get this error:

Fatal error: Class 'PDO' not found in /home/ior49618/public_html/catalog/includes/phpids/lib/IDS/Log/Database.php on line 170

I have followed the instructions step-by-step. Can you help please?

Please verify whether you have done the following:

Step-A: [Core]
6. Grant write access [chmod 777] to the "tmp" folder [phpids/lib/IDS/tmp] and also to phpids_log.txt log file which is inside the "tmp" folder.

Step-B: [Admin]
Important: Before going to the next step, go to your admin and click PHPIDS Log and then Banned IP under Tools for creating the required tables to the database automatically.

#45 kramster

  • Community Member
  • 10 posts
  • Real Name:Mark Watson
  • Gender:Male
  • Location:Sydney, Australia

Posted 18 May 2010, 04:36

Hi Celextel,

Step-A: Verified - both are set to 777

Step-B: Verified. My database contains tables "banned_ip" and "phpids_intrusions"

Regards, Mark

#46 celextel

  • Community Member
  • 136 posts
  • Real Name:Lakshmanan S.
  • Location:Chennai

Posted 18 May 2010, 12:34

View Postkramster, on 18 May 2010, 04:36, said:

Hi Celextel,

Step-A: Verified - both are set to 777

Step-B: Verified. My database contains tables "banned_ip" and "phpids_intrusions"

Regards, Mark

Are you still getting the error?

Did you make any changes to the osc_phpids.php module file?

What is PHP Version that your server is using?

Please verify that the catalog/includes/application_top.php file has the following codes:
// include the list of project filenames
  require(DIR_WS_INCLUDES . 'filenames.php');

// include the list of project database tables
  require(DIR_WS_INCLUDES . 'database_tables.php');

// customization for the design layout
  define('BOX_WIDTH', 125); // how wide the boxes should be in pixels (default: 125)

// include the database functions
  require(DIR_WS_FUNCTIONS . 'database.php');

// make a connection to the database... now
  tep_db_connect() or die('Unable to connect to database server!');

// set the application parameters
  $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
  while ($configuration = tep_db_fetch_array($configuration_query)) {
    define($configuration['cfgKey'], $configuration['cfgValue']);
  }

// if gzip_compression is enabled, start to buffer the output
  if ( (GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) && (PHP_VERSION >= '4') ) {
    if (($ini_zlib_output_compression = (int)ini_get('zlib.output_compression')) < 1) {
      if (PHP_VERSION >= '4.0.4') {
        ob_start('ob_gzhandler');
      } else {
        include(DIR_WS_FUNCTIONS . 'gzip_compression.php');
        ob_start();
        ob_implicit_flush();
      }
    } else {
      ini_set('zlib.output_compression_level', GZIP_LEVEL);
    }
  }

just above the following code:
// include PHPIDS Module
include(DIR_WS_MODULES . 'osc_phpids.php');


#47 sky_diver

  • Community Member
  • 40 posts
  • Real Name:Lance Willis
  • Gender:Male

Posted 18 May 2010, 17:52

Excellent work Celextel. Glad to see you placed my Ip Containment and Management system into the code base. This is a great contribution that many store owners should find as a lifesaver.

#48 kramster

  • Community Member
  • 10 posts
  • Real Name:Mark Watson
  • Gender:Male
  • Location:Sydney, Australia

Posted 19 May 2010, 00:42

Celextel,

Yes, I'm still getting the error, which is
Fatal error: Class 'PDO' not found in /home/ior49618/public_html/catalog/includes/phpids/lib/IDS/Log/Database.php on line 170

The osc_phpids.php - yes I made the changes laid out in your documentation as well as setting line 75 to $show_result = 'true'; for the test.

My ISP is running PHP 5.2.5 on this host.

My application_top.php was as you've shown except that the
// include PHPIDS Module
include(DIR_WS_MODULES . 'osc_phpids.php');

was before the gzip compression section (because I don't have FWR Security Pro.
I moved it to follow the gzip bit, but the result is still the same.

Regards, Mark

Edited by kramster, 19 May 2010, 00:43.


#49 baddog

  • Community Member
  • 1,150 posts
  • Real Name:Dave
  • Gender:Male
  • Location:Columbus, Ohio

Posted 19 May 2010, 01:34

View Postcelextel, on 30 April 2010, 03:19, said:


What’s required to run the PHPIDS

You need at least PHP 5.1.6 to use all features of the PHPIDS.
If you have an earlier version of PHP (5.0.x) will this contribution still work? What features would not be available?

#50 celextel

  • Community Member
  • 136 posts
  • Real Name:Lakshmanan S.
  • Location:Chennai

Posted 19 May 2010, 02:37

View Postsky_diver, on 18 May 2010, 17:52, said:

Excellent work Celextel. Glad to see you placed my Ip Containment and Management system into the code base. This is a great contribution that many store owners should find as a lifesaver.

Yes. Your IP Containment and Management System is a great and most useful contribution. Thanks for creating that one.

#51 celextel

  • Community Member
  • 136 posts
  • Real Name:Lakshmanan S.
  • Location:Chennai

Posted 19 May 2010, 02:42

View Postkramster, on 19 May 2010, 00:42, said:

Celextel,

Yes, I'm still getting the error, which is
Fatal error: Class 'PDO' not found in /home/ior49618/public_html/catalog/includes/phpids/lib/IDS/Log/Database.php on line 170

The osc_phpids.php - yes I made the changes laid out in your documentation as well as setting line 75 to $show_result = 'true'; for the test.

My ISP is running PHP 5.2.5 on this host.

My application_top.php was as you've shown except that the
// include PHPIDS Module
include(DIR_WS_MODULES . 'osc_phpids.php');

was before the gzip compression section (because I don't have FWR Security Pro.
I moved it to follow the gzip bit, but the result is still the same.

Regards, Mark

1. We were getting error when we put our code before gzip compression code. Please put this after it.

2. Please upload the original osc_phpids.php without any modification and do the testing. As such we have not suggested any changes to osc_phpids.php. It is pre-configured and would pickup your configuration settings in the osCommerce automatically.

#52 celextel

  • Community Member
  • 136 posts
  • Real Name:Lakshmanan S.
  • Location:Chennai

Posted 19 May 2010, 02:44

View Postbaddog, on 19 May 2010, 01:34, said:

If you have an earlier version of PHP (5.0.x) will this contribution still work? What features would not be available?

This should also work in the earlier versions of PHP. We have not tested it in the earlier version. Please test and let us know.

#53 kramster

  • Community Member
  • 10 posts
  • Real Name:Mark Watson
  • Gender:Male
  • Location:Sydney, Australia

Posted 20 May 2010, 01:45

Hi Celextel,

I uploaded the original osc_phpips.php file and still get the same result.

What I haven't mentioned which may be relevant is that I am running OSC under Joomla. The OSC part of the directory structure is www.iorarua.com/catalog/... which is where I've installed all the PHPIDS code. So, for instance, we have www.iorarua.com/catalog/includes/modules/osc_phpids.php.

Now, after the above test, before reverting to the original application_top.php so we can still use the site, I went to www.iorarua.com and got these errors at the top of the page.

Warning: include(/home/ior49618/public_html/plugins/system/oscommerce/modules/osc_phpids.php) [function.include]: failed to open stream: No such file or directory in /home/ior49618/public_html/catalog/includes/application_top.php on line 95

Warning: include() [function.include]: Failed opening '/home/ior49618/public_html/plugins/system/oscommerce/modules/osc_phpids.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ior49618/public_html/catalog/includes/application_top.php on line 95

Warning: include(/home/ior49618/public_html/plugins/system/oscommerce/modules/banned_ip.php) [function.include]: failed to open stream: No such file or directory in /home/ior49618/public_html/catalog/includes/application_top.php on line 125

Warning: include() [function.include]: Failed opening '/home/ior49618/public_html/plugins/system/oscommerce/modules/banned_ip.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ior49618/public_html/catalog/includes/application_top.php on line 125

If I then go to www.iorarua.com/catalog I get this:

1146 - Table 'ior49618_jo151.TABLE_BANNED_IP' doesn't exist

select ip_address from TABLE_BANNED_IP where ip_status='0'

[TEP STOP]

I checked my database and there is in fact a table "banned_ip" (as well as "phpids_intrusions")

Does any of this help?

#54 celextel

  • Community Member
  • 136 posts
  • Real Name:Lakshmanan S.
  • Location:Chennai

Posted 20 May 2010, 02:29

View Postkramster, on 20 May 2010, 01:45, said:

Hi Celextel,

I uploaded the original osc_phpips.php file and still get the same result.

Warning: include(/home/.../plugins/system/oscommerce/modules/osc_phpids.php) [function.include]: failed to open stream: No such file or directory in /home/.../catalog/includes/application_top.php on line 95

Warning: include(/home/.../plugins/system/oscommerce/modules/banned_ip.php) [function.include]: failed to open stream: No such file or directory in /home/.../catalog/includes/application_top.php on line 125

Does any of this help?

The first error code shows that you do not have our 2 module files in the following paths:
/home/.../plugins/system/oscommerce/modules/osc_phpids.php
/home/.../plugins/system/oscommerce/modules/banned_ip.php
[Avoid giving the full paths in the forums.]

Make these module files available in these paths and the problem may be sorted out.

If not, you have to figure it out yourself as it is not difficult.

It would be difficult for us to guide you as to how to configure our module in the osc under Joomla as we are not using Joomla.

Alternatively, you could integrate PHPIDS directly with Joomla. Please go through following URL in regard to this:
http://www.h-online.com/security/features/Serendipity-Joomla-Drupal-746342.html

Edited by celextel, 20 May 2010, 02:32.


#55 kramster

  • Community Member
  • 10 posts
  • Real Name:Mark Watson
  • Gender:Male
  • Location:Sydney, Australia

Posted 20 May 2010, 12:20

Hi Celextel,

I made those modules available in the indicated directory and got even more path-related errors.

Rather than go chasing my tail modifying paths, I think it would be prudent to take your second suggestion to back out and instal PHPIDS under Joomla as this is my main front-end.

I'll let you know how I go with that.

Thank you for all your help ... much appreciated.

Regards, Mark

#56 mumbo719

  • Community Member
  • 7 posts
  • Real Name:Warren G
  • Gender:Male
  • Location:Tampa Bay, USA

Posted 30 May 2010, 08:49

Hi Celextel,

Thank you for a great contribution.

I have a small issue that may be host related not PHPIDS But I'm not sure.

I get this error when running tests

500 Error - Internal Server Error
This error was caused due to an unexpected difficulty in fulfilling the user request. The most likely cause of this error is a crashed or error'd CGI script or program. Please verify that the program is properly compiled and/or operational and carry out any necessary debugging.
If you are not responsible for this resource, please send a bug-report to the address listed below describing your problem. Please include in the report the date, time, your e-mail address, the website on which this error occured and what you were attempting to do when this error occured. Your compliance is appreciated.

I get the e-mails - PHPIDS detects an intrusion attempt at ics-supply.com just fine

The PHPIDS Log Report is working listing all tests

The tmp directory and .txt file has 777 permission

On the second test the impact score is 36

I set the
$ip_ban_impact = 20;
to test but am not getting an automatic ban.

Running php 5.2.12

Thanks again for the contribution!

#57 mumbo719

  • Community Member
  • 7 posts
  • Real Name:Warren G
  • Gender:Male
  • Location:Tampa Bay, USA

Posted 30 May 2010, 09:44

**UPDATE**

On test 2 I got banned after 4 tries.

The message
"If you feel you have reached this page in error, please Contact Us and provide your IP Address."

Directs you to the Contact Us page which I am now banned from :)

#58 Mort-lemur

  • Community Member
  • 1,043 posts
  • Real Name:Heather
  • Gender:Female
  • Location:UK

Posted 30 May 2010, 10:20

Hi,

I am thinking of installing this, but first need a little more info:

1) should I first remove the original IP Trap contribution?
2) Is this compatible with the Anti Hacker Account Mods Contribution by Spooks?

Thanks
Now my store is the way I want it - Secure, working well, and good Google Ranks - Thanks to all for the help given.

If you want to see the mods I have installed, then see my profile.

#59 celextel

  • Community Member
  • 136 posts
  • Real Name:Lakshmanan S.
  • Location:Chennai

Posted 30 May 2010, 11:53

View Postmumbo719, on 30 May 2010, 09:44, said:

**UPDATE**

On test 2 I got banned after 4 tries.

The message
"If you feel you have reached this page in error, please Contact Us and provide your IP Address."

Directs you to the Contact Us page which I am now banned from :)

>> 500 Error - Internal Server Error
This is not related to PHPIDS. You could create a support request with the web host to do the needful in regard to this [error handling].

>> On test 2 I got banned after 4 tries.
This should have happened at the first instance itself.
Perhaps this problem would get solved if the error handling is configured by the server admin properly.

#60 celextel

  • Community Member
  • 136 posts
  • Real Name:Lakshmanan S.
  • Location:Chennai

Posted 30 May 2010, 11:57

View PostMort-lemur, on 30 May 2010, 10:20, said:

Hi,

I am thinking of installing this, but first need a little more info:

1) should I first remove the original IP Trap contribution?
2) Is this compatible with the Anti Hacker Account Mods Contribution by Spooks?

Thanks

1. Yes, IP Trap contribution is not needed and you could remove it before installing PHPIDS.

2. You could have PHPIDS along with Anti Hacker Account Mods Contribution by Spooks. There should not be any compatibility issues.