Skip to content

Instantly share code, notes, and snippets.

View mikeclarke's full-sized avatar

Mike Clarke mikeclarke

View GitHub Profile
@mikeclarke
mikeclarke / Acuity
Created December 12, 2010 21:55
Installing and running Acuity
easy_install -U pip
pip install -U virtualenv
cd /install/directory/location/
virtualenv --no-site-packages acuity
cd acuity/
source bin/activate
pip install django
pip install twisted
# Running the application
cd /install/directory/location/acuity/
@mikeclarke
mikeclarke / Credit card grep
Created December 12, 2010 21:48
Locating credit card data in log files
find /var/log/application/* -name "*.log" -type f -mtime -1
-exec egrep -Hn \
'\b(?:4[0-9]{12}(?:[0-9]{3})?
|5[1-5][0-9]{14}
|6(?:011|5[0-9][0-9])[0-9]{12}
|3[47][0-9]{13}
|3(?:0[0-5]|[68][0-9])[0-9]{11}
|(?:2131|1800|35\d{3})\d{11})\b'
{} > ~/output.out \;
@mikeclarke
mikeclarke / postgres-install
Created December 12, 2010 21:44
Basic PostgreSQL install
# Install the postgres packages
yum install postgresql postgresql-server
# Configure postgresql to start automatically on boot
chkconfig postgresql on
# Stat posgresql
service postgresql start
# Switch to postgres user (required to make initial connection to postgresql with default configuration)
su - postgres
# Make initial connection to the database to test connectivity
psql -d template1 -U postgres
@mikeclarke
mikeclarke / package-install
Created December 12, 2010 21:42
Installing baseline packages
yum update
yum groupinstall 'Development Tools'
@mikeclarke
mikeclarke / iptables
Created December 12, 2010 21:41
Initial iptables configuration
# Flush iptables rules (start with a clean slate where all traffic to all destinations is allowed)
iptables -F
# Allow loopback traffic
iptables -A INPUT -i lo -j ACCEPT
# Reject traffic destined to any port on IP address 127.0.0 through 127.0.0.7
# iptables -A INPUT -i ! lo -d 127.0.0.0/8 -j REJECT
# Allow all ESTABLISHED and RELATED connections to stay up
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow all external hosts to be reachable from the box
iptables -A OUTPUT -j ACCEPT
@mikeclarke
mikeclarke / Add user
Created December 12, 2010 21:39
Initial user setup on a CentOS box
# Create a new user (CentOS will create /home/admin as well)
adduser admin
# Assign the user a new password
passwd admin
# Add the user to the "wheel" group
usermod -a -G wheel admin
# Edit the /etc/sudoer file (requires knowledge of vi)
visudo