Last active
August 29, 2015 14:17
-
-
Save hotfix31/abbe645b57a07c01cdbb to your computer and use it in GitHub Desktop.
Revisions
-
hotfix31 revised this gist
Jun 26, 2015 . 1 changed file with 0 additions and 53 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -71,43 +71,6 @@ export TMPDIR="/var/tmp" export PS1 EOF echo "## Vim" cat > /etc/vim/vimrc.local <<EOF syntax on @@ -119,22 +82,6 @@ set modelines=1 set title EOF echo "# Cron-APT" cat > /etc/cron-apt/config <<EOF APTCOMMAND=/usr/bin/aptitude -
hotfix31 created this gist
Mar 23, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,181 @@ #!/bin/bash echo "### Post-install" cd / N=`date +%F` H=`hostname -s` I=`hostname -i` F=`hostname -f` echo "## APT" echo "# Configure..." cat > /etc/apt/sources.list <<EOF deb http://ftp.fr.debian.org/debian/ wheezy main non-free contrib #deb-src http://ftp.fr.debian.org/debian/ wheezy main non-free contrib EOF cat > /etc/apt/sources.list.d/deb_updates.list <<EOF # wheezy-updates, previously known as 'volatile' deb http://ftp.fr.debian.org/debian/ wheezy-updates main contrib non-free #deb-src http://ftp.fr.debian.org/debian/ wheezy-updates main contrib non-free EOF cat > /etc/apt/sources.list.d/deb_secu.list <<EOF deb http://security.debian.org/ wheezy/updates main contrib non-free #deb-src http://security.debian.org/ wheezy/updates main contrib non-free EOF cat > /etc/apt/apt.conf.d/10norecommends <<EOF APT::Install-Recommends "0"; EOF cat > /etc/apt/apt.conf.d/10nosuggests <<EOF APT::Install-Suggests "0"; EOF echo "# Update package list..." aptitude update echo "# Upgrade installed packages..." aptitude -y safe-upgrade echo "# Install a few useful packages..." aptitude -y install vim-nox sudo screen inetutils-telnet ntpdate bsd-mailx logrotate multitail tcpdump nmap lsof ssmtp bind9-host atop htop iptraf psmisc less mlocate mtr python rsync unzip dnsutils whois cron-apt geoip-database snmp snmpd openssh-server file lockfile-progs openssh-blacklist openssh-blacklist-extra logwatch echo "## Sample bash config" echo "# for 'root'" cat > /root/.bashrc <<EOF # ~/.bashrc: executed by bash(1) for non-login shells. export LS_OPTIONS='--color=auto' eval "\`dircolors\`" alias ls='ls \$LS_OPTIONS' alias ll='ls \$LS_OPTIONS -l' alias l='ls \$LS_OPTIONS -lA' alias grep="grep --color" # Some more alias to avoid making mistakes: alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' # Prompt case "\$TERM" in xterm*|rxvt*) PS1="[\u@\h: \w]\\\$ " export PROMPT_COMMAND='echo -ne "\033]0;\${USER}@\${HOSTNAME}: \${PWD}\007"' ;; screen) PS="[\u@\h: \w]\\\\$ " export PROMPT_COMMAND='echo -ne "\ek$(echo ${USER}@${HOSTNAME}: ${PWD/$HOME/\~})\e\\"' ;; *) PS1="[\u@\h: \w]\\\$ " ;; esac # pour ne pas que dpkg soit gene par le noexec de /tmp export TMPDIR="/var/tmp" export PS1 EOF echo "## for 'admin'..." cat > /home/admin/.bashrc <<EOF [ -z "\$PS1" ] && return export HISTCONTROL=\$HISTCONTROL\${HISTCONTROL+,}ignoredups export HISTCONTROL=ignoreboth shopt -s histappend shopt -s checkwinsize case "\$TERM" in xterm*|rxvt*) PS1="[\u@\h: \w]\\\$ " export PROMPT_COMMAND='echo -ne "\033]0;\${USER}@\${HOSTNAME}: \${PWD}\007"' ;; screen) PS="[\u@\h: \w]\\\\$ " export PROMPT_COMMAND='echo -ne "\ek$(echo ${USER}@${HOSTNAME}: ${PWD/$HOME/\~})\e\\"' ;; *) PS1="[\u@\h: \w]\\\$ " ;; esac export PS1 if [ -x /usr/bin/dircolors ]; then eval "\`dircolors -b\`" alias ls='ls --color=auto --time-style=long-iso' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi EOF chown 1000:1000 /home/admin/.bashrc chmod 0644 /home/admin/.bashrc echo "## Vim" cat > /etc/vim/vimrc.local <<EOF syntax on set hls set showmatch set laststatus=2 set modeline set modelines=1 set title EOF echo "# SSMTP" cat > /etc/ssmtp/ssmtp.conf <<EOF [email protected] mailhub=smtp.gmail.com:587 rewriteDomain= FromLineOverride=YES [email protected] UseSTARTTLS=YES [email protected] AuthPass=Pa55w0rd EOF cat > /etc/ssmtp/revaliases <<EOF root:[email protected]:smtp.gmail.com:587 admin:[email protected]:smtp.gmail.com:587 EOF echo "# Cron-APT" cat > /etc/cron-apt/config <<EOF APTCOMMAND=/usr/bin/aptitude MAILON="upgrade" SYSLOGON="error" DIFFONCHANGES=prepend EOF cat > /etc/cron-apt/action.d/3-download <<EOF autoclean -y safe-upgrade -d -y -o APT::Get::Show-Upgraded=true -o quiet=2 EOF cat > /etc/cron-apt/action.d/0-update <<EOF update -o quiet=2 EOF echo "# Cron" cat > /etc/cron.d/perso <<EOF 0 0 * * * root /usr/sbin/logrotate /etc/logrotate.conf > /dev/null 2> /dev/null || /bin/true 59 23 * * * root /usr/sbin/logwatch --mailto [email protected] --output mail > /dev/null 2> /dev/null || /bin/true EOF chmod 0755 /etc/cron.d/tfb echo -e '#!/bin/sh\nexit 0' > /etc/cron.daily/logrotate chmod 0444 /etc/cron.daily/logrotate echo -e '#!/bin/sh\nexit 0'> /etc/cron.daily/00logwatch chmod 0444 /etc/cron.daily/00logwatch echo "# Default editor/pager" update-alternatives --set editor /usr/bin/vim.nox update-alternatives --set pager /bin/less echo "# Disable some needless services" for s in atop mpt-statusd rsync do echo -n "## disable $s... " update-rc.d $s disable &> /dev/null if [ $? -eq 0 ] then echo OK else echo KO fi done echo "*** DONE ***"