GoAccess Usage

Installation
https://goaccess.io/download

Config File
sudo vim /usr/local/etc/goaccess.conf
time-format %H:%M:%S
date-format %d/%b/%Y
log-format %h [%d:%t %^] \"%r\" %>s %b %D %T \"%{Referer}i\" \"%{User-Agent}i\"

Generate HTML Report
goaccess -f /.../logs/access.log > /.../reports.html

Change Apache Log Format

vim /etc/httpd/conf/extra/httpd-vhosts.conf
CustomLog "...../logs/access.log" vhost_combined
LogFormat "%h %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined

Reference:
https://blog.elijaa.org/2010/09/07/how-to-make-apache-log-real-scriptname-and-execution-time-with-mod_rewrite-and-logformat/

Lock Linux Account

Lock an account
usermod --lock --expiredate 1970-01-02 username

Check lock status
sudo passwd -S username

MySQL Password Policy

Require the password to be changed every 90 days
ALTER USER 'alan'@'localhost' PASSWORD EXPIRE INTERVAL 90 DAY;

Only work on MySQL 5.7+

Problem:
imuxsock begins to drop messages from pid due to rate-limiting

Solution:
vim /etc/rsyslog.conf
$SystemLogRateLimitInterval 60
$SystemLogRateLimitBurst 3000

/etc/init.d/rsyslog restart

Reference:
http://navyaijm.blog.51cto.com/4647068/1212042
http://www.rsyslog.com/tag/rate-limiting/

Enable Apache Log Rotate

CustomLog "|/usr/sbin/rotatelogs -l /var/log/httpd/access.log.%Y%m%d 604800" combined
ErrorLog "|/usr/sbin/rotatelogs -l /var/log/httpd/error.log.%Y%m%d 604800"

Reference:
https://www.phpini.com/apache/apache-log-rotate

Show Timestamp in Bash History

echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bashrc
source ~/.bashrc

Using Composer

composer require jamesryanbell/cloudflare

Install Composer on OS X

curl -sS https://getcomposer.org/installer | php

sudo mv composer.phar /usr/local/bin/

vim ~/.bash_profile
alias composer="php /usr/local/bin/composer.phar"

Reference: https://www.abeautifulsite.net/installing-composer-on-os-x

CentOS-5 is now past EOL

cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

vim /etc/yum.repos.d/CentOS-Base.repo

Comment out the mirrorlist directives. In each enabled section add baseurl=http://vault.centos.org/5.11/os/$basearch, baseurl=http://vault.centos.org/5.11/updates/$basearch, etc.

Reference: https://unix.stackexchange.com/questions/359902/yum-update-error-on-centos-5-6

Flag Counter