Skip to content

Instantly share code, notes, and snippets.

View karthiks's full-sized avatar
😄
Playing with GraphQL

Karthik Sirasanagandla karthiks

😄
Playing with GraphQL
View GitHub Profile
@karthiks
karthiks / case2.ps
Created September 14, 2021 13:08
Case 2: When you want to list files containing any of texts "abc" or "pqr" or "xyz".
Get-ChildItem -Recurse | Select-String -Pattern 'abc', 'pqr', 'xyz' -List | Select Path
# Select-String commandlet can take an array list of strings that it can search for existence and returns all files that has any of those strings in its content.
@karthiks
karthiks / case1.ps
Created September 14, 2021 13:02
Case 1: When you want to list files containing text "abc".
Get-ChildItem -Recurse | Select-String -Pattern 'abc' -List | Select Path
@karthiks
karthiks / mpm_prefork.conf
Created September 13, 2021 13:01
Config for php deployment that is using mpm_prefork_module for it to work with mod_evasive module
StartServers 10
MinSpareServers 10
MaxSpareServers 10
MaxRequestWorkers 80
MaxConnectionsPerChild 0
@karthiks
karthiks / evasive.conf
Created September 13, 2021 12:57
Minimal workable configuration for mod_evasive
<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 1
DOSSiteCount 3
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 10
#DOSEmailNotify geek@codonomics.com
#DOSSystemCommand "su - someuser -c '/sbin/... %s ...'"
#DOSLogDir "/var/log/mod_evasive"
@karthiks
karthiks / enabled_apache_extensions.sh
Created September 13, 2021 12:46
verify whether the mod_evasive module is enabled
apachectl -M | grep evasive
# Output:
# [Mon Jan 27 13:55:35.707317 2020] [so:warn] [pid 29031] AH01574: module dav_module is already loaded, skipping
# evasive20_module (shared)
@karthiks
karthiks / apache2.conf
Created September 13, 2021 12:19
/etc/apache2/apache2.conf file
SetEnvIf Remote_Addr "::1" loopback
SetEnvIf Remote_Addr "127\.0\.0\.1" loopback
CustomLog /var/log/apache2/access.log combined env=!loopback
@karthiks
karthiks / conf
Created July 21, 2021 18:30
Ops Agent configuration to send the Apache2 webserver logs as well apart from the syslogs to Google Cloud Monitoring
logging:
receivers:
mywebserver:
type: files
include_paths:
- /var/log/apache*/access.log
- /var/log/apache*/error.log
- /var/www/logs/any-other-custom-logs-of-your-app-*.log
service:
pipelines:
@karthiks
karthiks / conf
Created July 21, 2021 18:02
Apache configuration file for the default website
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteMap hosts-deny "txt:/etc/apache2/blacklist"
RewriteCond "${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND}" "!=NOT-FOUND" [OR]
RewriteCond "${hosts-deny:%{REMOTE_HOST}|NOT-FOUND}" "!=NOT-FOUND"
RewriteRule .* - [F]
@karthiks
karthiks / conf
Created July 21, 2021 17:58
Select part of Apache configuration file for the default website
RewriteEngine on
RewriteMap hosts-deny "txt:/etc/apache2/blacklist"
RewriteCond "${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND}" "!=NOT-FOUND" [OR]
RewriteCond "${hosts-deny:%{REMOTE_HOST}|NOT-FOUND}" "!=NOT-FOUND"
RewriteRule .* - [F]
@karthiks
karthiks / conf
Created July 21, 2021 17:53
Range of IP Addresses
71.119.54.101 -
52.123.54.102 -