Setup GNU/Linux

Per ogni nuova macchina o login ci sono dei settaggi che mi serve poter ritrovare sveltamente per mettermi comodo.

Questi in particolare per OpenBSD

bashrc

export PS1='\[\e[0;35m\]\u@\h:\w\[\e[0m\]\$ '

export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias l='ls -lhp'
alias ll='ls -Ahlp'
alias lll='ls -Ahlp | less'
alias lk='ls -lShrp'
alias ls_ord='ls -lartp'
alias ls_count="ls -1 | wc -l"

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

alias tarra="tar -cvf $1"
alias tarragizippa="tar -czvf $1"
alias untarra="tar -xvvf $1"
alias untarragizzippa="tar -xzvf $1"
alias ungizippa="gzip -d $1"
alias untarrabunzippa2="tar -xIvf $1"
alias unbunzippa="bzip2 -d $1"
alias uncompress="uncompress $1"
alias unrarra="rar x $1"

alias apache-verifica="apache2ctl configtest"
alias apache-restart="service apache2 restart"

alias rkhunter-verifica-la-nuova-configurazione="rkhunter -C"
alias rkhunter-vcheck="rkhunter --versioncheck"
alias rkhunter-update="rkhunter --update"
alias rkhunter-quick="rkhunter -c --enable all --disable none --rwo"
alias rkhunter-partiamo-da-qui="rkhunter --propupd"

alias processi='ps -U $LOGNAME'
alias k9='kill -9'

nanorc

syntax "all" "[\.]*$"
color green "^#.*$"

screenrc

startup_message off
caption always "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"

MySQL o MariaDB

mysql_secure_installation # setup
mysqldump -u root -p --all-databases | gzip > ~/$host-sql-$date.sql.gz # backup

ssh-agent

crea e upload una pubkey in ~/.ssh/authorized_keys

edita /etc/ssh/sshd_config

PermitRootLogin no
PasswordAuthentication no

/etc/init.d/ssh reload # reload sshd config

perms

find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

lista sw

dpkg --get-selections | grep -vi kernel > list

tar backup (di /etc)

tar -zcpf etc.tgz /etc/

ufw firewall

ufw status verbose
ufw reset
ufw default deny incoming
ufw default allow outgoing
ufw allow ssh
sudo ufw enable

DNS memo

* 10800 IN A x.xxx.xxx.x
@ 10800 IN A x.xxx.xxx.x
cloud 10800 IN A xx.xxx.xxx.x
www 10800 IN CNAME dominio.org.