Security¶
CpHulk¶
DOS attack methods¶
Firewalls such as CSF with LFD; Apache’s mod_evasive or mod_qos modules for Apache-specific attacks.
cPHulk does not provide protection against these types of attacks.
- BruteForce attack (Authentication-based)
Tools to use:¶
cPHulk Brute Force Protection provides an effective layer of protection against these types of attacks,
by monitoring incoming authentication attempts and applying rules as necessary.
Cphulk applies to the following services¶
- SSH, FTP, IMAP , POP3, SMTP
- And Any 3rd-party services that authenticate using PAM.
Mod Security CONFIGURATION FILES /etc/apache2/conf.d/modsec_vendor_configs/¶
Mod Security Phases¶
- 5 Phases of Http traffic filtration
- Request Header
- Request Body
- Response Header
- Response Body
- Logging
Full list of Headers¶
request-header = Accept
- Accept-Charset
- Accept-Encoding
- Accept-Language
- Authorization
- Expect
- From
- Host
- If-Match
- If-Modified-Since
- If-None-Match
- If-Range
- If-Unmodified-Sinc
- Max-Forwards
- Proxy-Authorizatio
- Range
- Referer
- TE
- User-Agent
Request Body¶
Method "OPTIONS"
- "GET"
- "HEAD"
- "POST"
- "PUT"
- "DELETE"
- "TRACE"
- "CONNECT"
- extension-method
- extension-method = token
Response Header¶
- Accept-Ranges
- Age
- ETag
- Location
- Proxy-Authenticate
- Retry-After
- Server
- Vary
- WWW-Authenticate
Response Body¶
- Status Codes 200,400,404,500,504,502 etc
Logging¶
ModSecurity Rules Documentation¶
Syntax of ModSecurity¶
SecRule Variables Operator [Action]
Mod Security actions¶
-
Disruptive
The ModSecurity engine acts on the item, whether that be to allow, refuse, or otherwise alter a transaction. -
Non-Disruptive
An action is taken, however, it is prevented from interrupting or affecting the processing of rules. This might be something like modifying the value of a variable or creating a new variable. -
Flow
A change in the progression of rule processing - an example of this might be a rule that instructs ModSecurity to skip to another rule. -
Meta-Data
Analyzes specifically the meta-data values of the item (id, msg, URI, and data), which provides a data fragment for analysis. Find more information in the official ModSecurity documentationDocs -
Data
Primarily used to hold notes or additional details of some kind and does not interfere or act on the connection being processed
Types of attacks ModSec can protection¶
- Code/SQL injection
- DoS via HTTP POST
- Common Exploits
- Common Trojans
Security Models¶
-
POSITIVE Model ModSecurity rejects everything except confirmed / whitelisted traffic.
-
NEGATIVE Model ModSecurity seeks out malicious traffic to filter from the entirety of incoming requests.
-
Virtual Patching
-
Extrusion Detection
CSF And Host Access Control¶
-
Works with file : /etc/hosts.allow Those services include:
-
cPanel (cpaneld)
-
WHM (whostmgrd)
-
Webmail (webmaild)
-
Web Disk (cpdavd)
-
FTP (ftpd)
-
SSH (sshd)
-
SMTP (smtp)
-
POP3 (pop3)
-
IMAP (imap)
FTP Enabloing FTP port range passive ports in iptables¶
https://www.cyberciti.biz/faq/linux-iptables-multiport-range/ cPanel docs
- Using NFT Tablesnft add rule filter INPUT tcp dport 49152-65534 accept
nft -s list ruleset | tee /etc/sysconfig/nftables.conf # to save the ruleset post reboot
- FirewallCMD
firewall-cmd --permanent --zone=public --add-service=ftp
firewall-cmd --permanent --add-port=49152-65534/tcp
firewall-cmd --reload
- Your IP address is then automatically added as the first IP address on the verified IP address list, stored here:
- The question/answer information is stored here (with the answers encrypted):
- As you might guess, the file you'll find this information in may be different for resellers that have these policies configured - hence the specification of "root" as the filename here (leaving room for other user-named files as well).