LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-02-2021, 12:51 PM   #1
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Rep: Reputation: Disabled
Post What is the difference between "/etc/httpd/conf.d/" and "/etc/httpd/conf.modules.d/" directories?


Hello,
I'm using CentOS 8 x86_64 and I installed ModSecurity on it.
According to the https://github.com/coreruleset/corer....4/dev/INSTALL, I must add below lines to the "httpd.conf/apache2.conf" file, but that file is for Debian:
Code:
 <IfModule security2_module>
          Include modsecurity.d/owasp-modsecurity-crs/crs-setup.conf
          Include modsecurity.d/owasp-modsecurity-crs/rules/*.conf
    </IfModule>
I found two files about the ModSecurity:
  1. /etc/httpd/conf.modules.d/10-mod_security.conf
  2. /etc/httpd/conf.d/mod_security.conf
But which file is OK to add above lines?

Thank you.
 
Old 03-02-2021, 04:22 PM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Why don't you look inside? They are simple text files. If I remember well, one is for configuring Apache to use mod_security. The other is for configuring mod_security itself. Which is which? I suggest you figure it out.
 
Old 03-03-2021, 12:50 AM   #3
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
Why don't you look inside? They are simple text files. If I remember well, one is for configuring Apache to use mod_security. The other is for configuring mod_security itself. Which is which? I suggest you figure it out.
Thank you.
I did, but I'm not familiar with it and don't know which one is for configuring Apache to use mod_security and which one is for configuring mod_security itself.
The content of the first file is :
Code:
$ cat /etc/httpd/conf.modules.d/10-mod_security.conf 
LoadModule security2_module modules/mod_security2.so
<IfModule !mod_unique_id.c>
    LoadModule unique_id_module modules/mod_unique_id.so
</IfModule>
And the content of the second file is :
https://paste.ubuntu.com/p/Rtz6jRrwzT/

I added below lines to "/etc/httpd/conf.d/mod_security.conf" file and restarted my Apache:
Code:
IncludeOptional modsecurity.d/owasp-modsecurity-crs/*.conf
IncludeOptional modsecurity.d/owasp-modsecurity-crs/rules/*.conf
But I got below error:
Code:
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/httpd.service.d
           └─php-fpm.conf
   Active: failed (Result: exit-code) since Wed 2021-03-03 10:23:52 +0330; 13s ago
     Docs: man:httpd.service(8)
  Process: 4023589 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
  Process: 4167747 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 4167747 (code=exited, status=1/FAILURE)
   Status: "Reading configuration..."

Mar 03 10:23:51 extra systemd[1]: Starting The Apache HTTP Server...
Mar 03 10:23:52 extra httpd[4167747]: [Wed Mar 03 10:23:52.263542 2021] [so:warn] [pid 4167747:tid 134683729852736>
Mar 03 10:23:52 extra httpd[4167747]: AH00526: Syntax error on line 829 of /etc/httpd/modsecurity.d/owasp-modsecur>
Mar 03 10:23:52 extra httpd[4167747]: ModSecurity: Found another rule with the same id
Mar 03 10:23:52 extra systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
Mar 03 10:23:52 extra systemd[1]: httpd.service: Failed with result 'exit-code'.
Mar 03 10:23:52 extra systemd[1]: Failed to start The Apache HTTP Server.
And line 829 of that file is:
Code:
SecAction \
 "id:900990,\
  phase:1,\
  nolog,\
  pass,\
  t:none,\
  setvar:tx.crs_setup_version=330"   ==> Line 829
I never modified that file!!!

Last edited by n00b_noob; 03-03-2021 at 01:02 AM.
 
Old 03-03-2021, 01:03 AM   #4
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,735

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
This is the definitive documentation for the Apache web server.
Search, read and learn....
 
Old 03-03-2021, 02:34 AM   #5
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by n00b_noob View Post
Code:
$ cat /etc/httpd/conf.modules.d/10-mod_security.conf 
LoadModule security2_module modules/mod_security2.so
<IfModule !mod_unique_id.c>
    LoadModule unique_id_module modules/mod_unique_id.so
</IfModule>
LoadModule is an Apache directive. This is to configure Apache.

Quote:
Originally Posted by n00b_noob View Post
According to the https://github.com/coreruleset/corer....4/dev/INSTALL, I must add below lines to the "httpd.conf/apache2.conf" file, but that file is for Debian
I think the central config file in Centos is /etc/httpd/conf/httpd.conf.

I can't comment on the rest. Perhaps scasey's link helps.

Last edited by berndbausch; 03-03-2021 at 02:37 AM.
 
Old 03-03-2021, 05:57 AM   #6
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
LoadModule is an Apache directive. This is to configure Apache.


I think the central config file in Centos is /etc/httpd/conf/httpd.conf.

I can't comment on the rest. Perhaps scasey's link helps.
If you look at https://paste.ubuntu.com/p/Rtz6jRrwzT/, it has a "# ModSecurity Core Rules Set and Local configuration" section that start with "IncludeOptional". because of it, I added that lines to this section!!
 
Old 03-06-2021, 05:03 AM   #7
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
My problem solved.
I removed the rules that I installed manually and problem solved. Kind of conflict.
When you install "mod_security_crs" package, then it installed the OWASP ModSecurity Core Rule Set.
 
Old 03-06-2021, 06:18 AM   #8
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by n00b_noob View Post
My problem solved.
If I may comment on your question: You didn't mention any problem until now. If you want the community to help you solve the problem, state it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
is there any difference between / etc/rsyslog.conf and /etc/rsyslogd.conf sigint-ninja Linux - Newbie 3 10-22-2016 03:19 PM
[SOLVED] what is difference between /etc/modules and /etc/initramfs-tools/modules ? masuch Linux - Newbie 4 05-29-2013 05:50 AM
httpd: Syntax error on line 210 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 iswarya Linux - Newbie 1 01-25-2012 01:28 PM
Starting httpd: httpd: Syntax error on line 209 of /etc/httpd/conf/httpd.conf: Syntax sethukpathi Linux - Networking 6 04-12-2008 11:26 AM
Difference between /etc/modules and /etc/modules.conf ? Biased turkey Debian 4 08-21-2005 10:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration