Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetupApacheUABlock ¶
func SetupApacheUABlock(report EventReporter) error
SetupApacheUABlock performs one-time Apache UA blocking setup. Supports both Debian (a2enconf) and RHEL (conf.d direct) layouts.
func SetupNginxUABlock ¶
func SetupNginxUABlock(report EventReporter) error
SetupNginxUABlock performs one-time nginx UA blocking setup:
- Writes /etc/nginx/conf.d/defensia-ua-block.conf (map + include)
- Creates /etc/defensia/ua-blocklist.conf (empty)
- Injects "if ($defensia_blocked_ua) { return 444; }" into every server block
- Runs nginx -t + nginx -s reload; rolls back on failure
- Writes sentinel /etc/defensia/.nginx-ua-ready so this runs only once
func UpdateApacheUABlock ¶
func UpdateApacheUABlock(fps []UAFingerprint, report EventReporter) error
UpdateApacheUABlock regenerates the Apache UA block config and does apachectl graceful. Skips reload if the generated config is identical to the current file.
func UpdateNginxUABlocklist ¶
func UpdateNginxUABlocklist(fps []UAFingerprint, report EventReporter) error
UpdateNginxUABlocklist regenerates /etc/defensia/ua-blocklist.conf and does nginx -s reload. If setup has not completed yet (sentinel absent), writes the file only — reload happens at setup time. Skips reload if the generated config is identical to the current file.
Types ¶
type EventReporter ¶
EventReporter is called when a config error must be reported to the panel.
type UAFingerprint ¶
UAFingerprint holds a user-agent pattern to block at the web server level.