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

#!/bin/bash

while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
GIT_WORK_TREE=/var/www/vhosts/website/htdocs git checkout -f $branch
done

Check CloudFlare CDN Info

http://xxx.com/cdn-cgi/trace

colo is the cdn location.

Flag Counter