Skip to content

Commit

Permalink
a couple of fixes needed in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
jrgm committed Jun 11, 2014
1 parent 49dc965 commit 1d80315
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 5 additions & 6 deletions users/ec2-user/pristinify.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
sudo rm -rf /tmp/*
#!/bin/sh

if [ $USER != "ec2-user" ]; then
Expand All @@ -19,7 +18,7 @@ fi
sudo rm -rf /tmp/*

# remove system logs
sudo rm -f /var/log/*
sudo find /var/log -type f | sudo xargs --no-run-if-empty /bin/rm -fv

# reinitialize git
sudo -u app rm -rf /home/app/git
Expand All @@ -33,19 +32,19 @@ sudo -u app rm -rf /home/app/{code,code.old,var,tmp}
sudo -u app -i git reset --hard HEAD

# re-initialize SSL keys
cd ~proxy
sudo -u proxy rm ~proxy/*.pem
sudo -u proxy ./gen_self_signed.sh
sudo -u proxy rm /home/proxy/{cert,key}.pem
sudo -u proxy -i /home/proxy/gen_self_signed.sh

# cut ourself off at the knees
truncate -s 0 ~/.ssh/authorized_keys

# clean out proxy logs
sudo rm -rf home/proxy/var/log/*
sudo find /home/proxy/var/log -type f | sudo xargs --no-run-if-empty /bin/rm -fv
sudo -u proxy -i git reset --hard HEAD

# remove command history
sudo rm -f ~{app,ec2-user,proxy}/.bash_history
sudo find /home/ec2-user/.emacs.d -type f | sudo xargs --no-run-if-empty /bin/rm -fv

# remove packages installed at creation time
if [ -f $HOME/packages.txt ] ; then
Expand Down
1 change: 1 addition & 0 deletions users/proxy/gen_self_signed.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env bash

cd /home/proxy
openssl genrsa -out key.pem 2048
openssl req -new -config request.cnf -x509 -key key.pem -out cert.pem -days 1095

0 comments on commit 1d80315

Please sign in to comment.