This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# hardware stress test | |
# mismatched md5sums shows a faulty disk/RAM | |
# time depends on hardware, ex: 1 sec per 100 count | |
dd if=/dev/zero of=/tmp/test.file bs=1M count=1000 | |
for i in {1..5}; do md5sum /tmp/test.file; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# installing mod_security http://www.modsecurity.org (Debian-based distro) | |
# apachectl -M | |
apache2: Could not reliably determine the server's fully qualified domain name, using boxmetric.com for ServerName | |
Loaded Modules: | |
core_module (static) | |
log_config_module (static) | |
logio_module (static) | |
mpm_prefork_module (static) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# Check which Linux users could log in with password, see "man shadow" for the second field in the /etc/shadow file: | |
# "If the password field contains some string that is not a valid result of crypt(3), for instance ! or *, the user will not be able to use a unix password to log in (but the user may log in the system by other means). | |
# this awk one-liner will find users that have common used * or ! in the password field or field starts with ! (locked account). It's possible that still found user cannot log in due to other non-crypt character in the field | |
awk -F: '$2 != "*" && $2 !~ /^!/ { print $1, " can log in" }' /etc/shadow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>CloudFlare Always Online</h1> | |
<b>Summary:</b> I'd like to know if CloudFlare's <a href="http://www.cloudflare.com/always-online">Always Online</a> works when a web server goes completely down (server unresponsive). | |
1) According to CloudFlare's web site, the answer seems to be "yes" (emphasis mine): | |
<ul> | |
<li><a href="http://www.cloudflare.com/always-online">Description of the service</a>: Always Online is a feature that caches a static version of your pages in case your <b>server goes offline</b>.</li> | |
<li><a ref="http://blog.cloudflare.com/always-online-because-downtime-sucks">Blog entry</a>: "If, for any reason, your web host or service provider <b>goes down</b>, we kick in to keep your site online"</li> | |
<li><a href="https://cloudflare.tenderapp.com/kb/troubleshooting/why-doesnt-always-online-display-all-pages-of-my-site-when-my-server-is-down">KB documentation</a>: on the point 7: "In order to trigger Always Online, your web server will need to be <b>completely unresponsive</b>, or ..."</li> | |
<li>In a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# files opened for writing | |
lsof | grep -e "[[:digit:]]\+w" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# redirect from apache port (:8080 for ex for tomcat etc) to subdomain | |
# in apache config: | |
<VirtualHost *:80> | |
ServerName subdomain.example.com | |
ProxyPass / http://127.0.0.1:8080/ | |
ProxyPassReverse / http://127.0.0.1:8080/ | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# Apache2 optimization | |
# apache-wide (/etc/apache2/apache2.config ): | |
# compression | |
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# Linux "Too many files open" error | |
# check current number of open files: | |
lsof |wc -l | |
# check maximum number of file descriptors | |
sysctl -a |grep file-max | |
# increment value: edit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# python script to test/monitor if a Django site using authentication is up | |
# with logging output to a file including response times | |
# use in cronjob and output to log file, for ex: python /path/to/script.py >> /var/log/webmonitor.log | |
# bash: install pip if not already in system | |
apt-get install python-setuptools python-dev build-essential | |
easy_install -U pip | |
# bash: install requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# Create Java KeyStore from SSL certificate for domain example.com | |
# Change format from cert.crt PEM (----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----) to DER | |
openssl x509 -in cert.crt -inform PEM -out cert.der -outform DER | |
# create KeyStore cert.jks for your domain ("alias" in keytool, "common name" or CN in openssl req) | |
keytool -import -trustcacerts -alias example.com -file cert.der -keystore cert.jks |