Skip to content

Instantly share code, notes, and snippets.

@alexcreek
alexcreek / apache-ssl-vhost.conf
Last active August 29, 2015 14:07
SSL enabled virtualhost template
<VirtualHost *:443>
ServerName securesite.com
ServerAlias www.securesite.com
DocumentRoot /var/www/securesite.com
# OCSP Stapling
SSLStaplingCache shmcb:/tmp/stapling_cache(128000) # place outside <virtualhost></virtualhost>
SSLCACertificateFile /etc/ssl/ca-certs.pem
SSLUseStapling on
@alexcreek
alexcreek / apache-debug.php
Last active August 29, 2015 14:07
Display every apache variable and request header using php
<?php
echo "<h1>REQUEST HEADERS</h1>";
$headers = apache_request_headers();
foreach ($headers as $header => $value) {
echo "$header: $value <br />\n";
}
echo "<h1>APACHE VARIABLES</h1>";
@alexcreek
alexcreek / check_connections
Created August 15, 2014 05:25
nagios plugin to monitor TCP/UDP connections
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo "WARN and CRIT thresholds not defined"
exit 3
fi
warn="$1"
crit="$2"
tcp=$(ss -tan | tail -n +3 | egrep -c -v "UNCONN|LISTEN")
@alexcreek
alexcreek / get-exit-nodes.sh
Last active March 5, 2023 00:29
Download a list of tor exit nodes from torproject.org
#!/bin/bash
curl -s https://check.torproject.org/exit-addresses | awk '/ExitAddress/ {print $2}' | sort -n
@alexcreek
alexcreek / return-address.php
Last active August 29, 2015 14:03
Usage: curl [FILE] - returns WAN IP address
<?php
$ua = getenv('HTTP_USER_AGENT');
$ip = getenv('REMOTE_ADDR');
if (strpos($ua,'curl') !== false) {
echo "$ip \n";
}
?>
@alexcreek
alexcreek / weighttp-output.patch
Created April 15, 2014 00:54
Modifies weighttp's output for easier grepping
diff -rupN /home/alex/source/weighttp/src/weighttp.c weighttp/src/weighttp.c
--- /home/alex/source/weighttp/src/weighttp.c 2014-04-13 14:05:00.359685093 -0400
+++ weighttp/src/weighttp.c 2014-04-14 20:34:59.470388698 -0400
@@ -234,6 +234,7 @@ int main(int argc, char *argv[]) {
uint64_t kbps;
char **headers;
uint8_t headers_num;
+ float full_duration;
printf("weighttp - a lightweight and simple webserver benchmarking tool\n\n");