Skip to content

Instantly share code, notes, and snippets.

@xyzkab
Last active April 6, 2018 10:07
Show Gist options
  • Save xyzkab/2b798ba81252f5e0aca58644a93cfeb7 to your computer and use it in GitHub Desktop.
Save xyzkab/2b798ba81252f5e0aca58644a93cfeb7 to your computer and use it in GitHub Desktop.
Things i'd ussually do after debian fresh install

Debian Things

Things i'd ussually do after debian fresh install

Disable unnecessary services

/etc/init.d/exim4 stop
/etc/init.d/rpcbind stop
update-rc.d -f exim4 remove
update-rc.d -f rpcbind remove

OpenSSH Config

Apply changes below at /etc/ssh/sshd_config

  • Port $(echo $RANDOM) never use the same port
  • ListenAddress 0.0.0.0
  • PermitRootLogin without-password
  • PasswordAuthentication no
  • UseDNS no

Create user

I usually create a user with dev prefix with RANDOM end for better opsec pfft

un=$(echo "dev$RANDOM")
adduser $un
su - $un
mkdir .ssh
cat > .ssh/authorized_keys
chmod 700 .ssh/
chmod 600 .ssh/authorized_keys

Disable recommends,suggests apt-packages

cat > /etc/apt/apt.conf
APT::Install-Recommends "0";
APT::Install-Suggests "0";

Update,Install necessary tools and library i needed

  • Tools and libraries
apt-get update
apt-get install tcpdump curl wget mlocate htop zip unzip ntpdate -y
apt-get install dh-autoreconf build-essential libxml2 libxml2-dev make automake zlib1g zlib1g-dev libreadline-dev tcpdump libssl-dev build-essential -y
apt-get install apache2 apache2-dev mysql-server libmysqlclient-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libgmp3-dev -y
  • Redis
cat > /etc/apt/sources.list.d/dotdeb.list
deb http://packages.dotdeb.org jessie all

wget https://www.dotdeb.org/dotdeb.gpg
apt-key add dotdeb.gpg
apt-get update
apt-get install redis-server redis-tools
add comment '#' to /etc/apt/sources.list.d/dotdeb.list
apt-get update
  • RVM
curl -sSL https://get.rvm.io | bash -s stable
source .rvm/scripts/rvm
rvm autolibs disable
rvm install ruby-2.3.1
rvm use ruby-2.3.1 --default

cat > .irbrc
IRB.conf[:PROMPT_MODE] = :SIMPLE
IRB.conf[:AUTO_INDENT_MODE] = false
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:PROMPT][:SIMPLE][:RETURN] = ''
require '~/gw/c0de/things/irb_utils'

mkdir -p gw/c0de/things
cat > ~/gw/c0de/things/irb_utils.rb
require 'json'
def clear
   system("clear")
end
def form_to_h(s)
   Hash[*s.split(/\&/).map {|e|
      f = e.split(/\=/)
      f.push("") if f.length !=2
   f
   }.flatten]
end
alias c :clear

cat > .gemrc
gem: --no-document --no-ri

gem install passenger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment