modsecurity on nginx_apache fresh install failed

shanky

Verified User
Joined
Dec 7, 2007
Messages
88
Hi

I have issues from installing modsecurity on nginx_apache with the following steps > -> set mod

./setup.sh -> Fresh Install nginx_apache with php 5.6+5.3 php-fpm
./build set modsecurity yes
./build modsecurity
./build nginx_apache
./build rewrite_confs

get errors:

Restarting nginx.
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

and see errors:

systemctl status nginx.service
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/etc/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2018-10-25 21:15:06 +07; 37s ago
Process: 23820 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)
Main PID: 28115 (code=exited, status=0/SUCCESS)

Oct 25 21:15:06 virgo.serviceips.com systemd[1]: Starting The nginx HTTP and reverse proxy server...
Oct 25 21:15:06 virgo.serviceips.com nginx[23820]: nginx: [emerg] ModSecurityConfig in /etc/nginx/nginx-modsecurity-enable.conf:2: Cannot open config file: /usr/local/cwaf/rules/rules.conf.main
Oct 25 21:15:06 virgo.serviceips.com nginx[23820]: nginx: configuration file /etc/nginx/nginx.conf test failed
Oct 25 21:15:06 virgo.serviceips.com systemd[1]: nginx.service: control process exited, code=exited status=1
Oct 25 21:15:06 virgo.serviceips.com systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Oct 25 21:15:06 virgo.serviceips.com systemd[1]: Unit nginx.service entered failed state.
Oct 25 21:15:06 virgo.serviceips.com systemd[1]: nginx.service failed.

In the folder /usr/local/cwaf/rules/ there is not files at all

ll /usr/local/cwaf/rules/
total 0

*** It used to have 1 file name like 00-Blank.... but I deleted it and re-install and now there is no file here.


Please advice how to fix it.

Thanks
 
Last edited:
Done that but same errors result.

Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
 
I did the command after ./build modsecurity :

./build nginx_apache
...
make[1]: Leaving directory `/usr/local/directadmin/custombuild/nginx-1.15.1'
Enabling nginx in systemd...
Using 69.30.232.154 for your server IP
Using 69.30.232.154 for your server IP
Checking to ensure /etc/httpd/conf/ssl.crt/server.ca is set.
Using 69.30.232.154 for your server IP
Restarting nginx.
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

and then

./build modsecurity_rules
| LOG : | LOG : Preparing file /usr/local/directadmin/plugins/comodo_waf/images/js/cwaf_wizard_ref.js
/usr/bin/id: cwaf_plugin: no such user
| LOG : Preparing Nginx configuration
| LOG : '/etc/nginx/nginx-modsecurity.conf' -> '/usr/local/cwaf/conf/modsec2_plugin.conf'
| LOG : All Done!
+------------------------------------------------------
| Installation complete!
| You may examine log file
| /tmp/cwaf_install.log.14170
| for errors in case not everything went flawless.
| Also you may examine file
| /usr/local/cwaf/INFO.TXT
| for some useful software information.
+------------------------------------------------------
Can't locate LWP.pm in @INC (@INC contains: /usr/local/cwaf/modules/CPAN/lib /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/cwaf/modules/CPAN/lib/Comodo/CWAF/ClientAPI.pm line 8.
BEGIN failed--compilation aborted at /usr/local/cwaf/modules/CPAN/lib/Comodo/CWAF/ClientAPI.pm line 8.
Compilation failed in require at /usr/local/cwaf/scripts/updater.pl line 12.
BEGIN failed--compilation aborted at /usr/local/cwaf/scripts/updater.pl line 12.
Installation of ModSecurity Rule Set has been finished.
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

and see errors:

systemctl status nginx.service
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/etc/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2018-10-26 01:44:07 +07; 12s ago
Process: 19833 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)
Main PID: 14740 (code=exited, status=0/SUCCESS)

Oct 26 01:44:07 virgo.serviceips.com systemd[1]: Starting The nginx HTTP and reverse proxy server...
Oct 26 01:44:07 virgo.serviceips.com nginx[19833]: nginx: [emerg] ModSecurityConfig in /etc/nginx/nginx-modsecurity-enable.conf:2: Cannot open config file: /usr/local/cwaf/rules/rules.conf.main
Oct 26 01:44:07 virgo.serviceips.com nginx[19833]: nginx: configuration file /etc/nginx/nginx.conf test failed
Oct 26 01:44:07 virgo.serviceips.com systemd[1]: nginx.service: control process exited, code=exited status=1
Oct 26 01:44:07 virgo.serviceips.com systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Oct 26 01:44:07 virgo.serviceips.com systemd[1]: Unit nginx.service entered failed state.
Oct 26 01:44:07 virgo.serviceips.com systemd[1]: nginx.service failed.

and Only 1 file in /usr/local/cwaf/rules/
[root@s134577 custombuild]# ls /usr/local/cwaf/rules/
00_blank.conf

Please help.

Thanks
 
Will it help?

Code:
yum install -y perl-libwww-perl
./build modsecurity_rules
 
Back
Top