Log all commands run by admins on production servers

Update: 2 more things that have popped up in the comments and in follow-up questions: Using auditd this way will dramatically increase your log volume, especially if the system is heavily in use via commandline. Adjust your log retention policy. Auditd logs on the host where they are created are just as secure as other … Read more

My /var/log/btmp file is huge! What should I do?

This means people are trying to brute-force your passwords (common on any public-facing server). It shouldn’t cause any harm to clear out this file. One way to reduce this is to change the port for SSH from 22 to something arbitrary. For some additional security, DenyHosts can block login attempts after a certain number of … Read more

Adding a directory to $PATH in CentOS?

It’s not a good idea to edit /etc/profile for things like this, because you’ll lose all your changes whenever CentOS publishes an update for this file. This is exactly what /etc/profile.d is for: echo ‘pathmunge /usr/lib/ruby-enterprise/bin’ > /etc/profile.d/ree.sh chmod +x /etc/profile.d/ree.sh Log back in and enjoy your (safely) updated $PATH: echo $PATH /usr/lib/ruby-enterprise/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin which ruby … Read more

Best way to gracefully restart CentOS?

Systems using systemd (CentOS >=7) will have the reboot, shutdown and halt commands symlinked to systemctl to handle the reboot. The systemctl program will detect the use of the symlink and run the systemctl command with the correstponing arguments. For the difference between the commands see the manpage for systemctl (man systemctl) for it is … Read more

How do you install Node.JS on CentOS?

su – yum install gcc-c++ openssl-devel cd /usr/local/src wget http://nodejs.org/dist/node-latest.tar.gz tar zxvf node-latest.tar.gz (cd into extracted folder: ex “cd node-v0.10.3″) ./configure make make install Note that this requires Python 2.6+ to use ./configure above. You can modify the “configure” file to point to python2.7 in line 1 if necessary. To create an RPM package, you … Read more

HAProxy vs. Nginx

I was looking at using HAProxy and Nginx for load balancing, and I had some questions: Should I use JUST HAProxy over Nginx for the proxy server? Is there any reason to have HAProxy and Nginx installed on the same proxy server? Thanks