Bobcares

ModSecurity failed to access DBM file- common causes and fixes

by | May 21, 2020

Many web servers now use ModSecurity Web Application Firewall to block brute force attacks, spam campaigns, malware infections, and more.

But what if ModSecurity fails?

Today we’ll see how the error “ModSecurity failed to access DBM file” causes ModSecurity to crash and how our support engineers here at Server Management Services help web hosts, digital agencies, and other online service providers quickly detect and fix this error.

 

ModSecurity failed to access DBM file!

ModSecurity rules especially those involve tracking user IP addresses use the ip.pag and ip.dir located at “/var/cpanel/secdatadir/ ” to store the collected data. At times, due to permission errors, file corruption, etc., these files will be inaccessible to the mod_security program, and it fails to filter web traffic.

That causes the error:

ModSecurity: Failed to access DBM file

In reality, end users may not identify the change easily. The only symptom that the web hosts experience is relatively higher resource usage. This may be due to higher rate of brute force attacks as ModSecurity stopped processing the rules to block IP addresses attempting for the attack.

Now, we’ll see the common causes for this error, and how to fix them.

 

Common Scenarios

A variety of reasons can cause ModSecurity to stop working. Certainly the key part of resolving it is to find the exact error that made ModSecurity to halt. An analysis of the apache error log will definitely help to generate a clear idea of the error message.

 

ModSecurity failed to access DBM file

 

For example, in the situation above, it is permission denied error to the file ‘”/var/cpanel/secdatadir/xxxxxxx-ip fille.

 

Scenario 1: Invalid argument

A sample error log for scenario issue looks as below:

Message: collection_store: Failed to write to DBM file "/var/cache/modsecurity/ip": Invalid argument 

This error is commonly related to the WAF/ web application firewall. Web application firewall filter, monitor, and block the traffic to/from a web application.

Recently, we saw such an issue where a recent update of the WAF corrupted the “/var/cache/modsecurity/ip.pag“. The solution here was of course to upgrade the WAF to a stable version and reset the “/var/cache/modsecurity/ip.pag” file.

 

Scenario 2: Permission denied

The most common form of the “ModSecurity failed to access DBM file” is the permission denied error.  As per cPanel’s official forums, there is a confirmed incompatibility for the Modsec module used by mod security to run with mod_ruid2.

Since it makes the apache process runs as the user and not as nobody, while running apache under mod_ruid2, apache cannot access the ip.pag and ip.dir files located in /var/cpanel/secdatadir/. Though some popular fix available online suggest changing the file permission of the “/var/cpanel/secdatadir/” to 777, it is not recommended. Besides this permission makes the file open to the world and easy to crack for a hacker.

Comparatively, switching to a combination of event and mod_suexec Multi-Processing Module is a safer solution. One can simply enable the Event MPM and disable the Worker MPM in the EA4 build profile. Once you start the next build, the EasyApache 4 update process will automatically take care of the installation.

 

[Need help to fix ModSecurity failed to access DBM file error? We are available 24×7]

 

Conclusion

In short, a variety of reasons can cause the ModSecurity failed to access DBM file error. Today we discussed the common reasons for this error and how our Support Engineers fix them.

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF