Go to file
2022-07-03 08:39:12 +00:00
.gitignore update 2022-06-19 16:02:00 +00:00
config update 2022-06-19 16:02:00 +00:00
Makefile update 2022-06-19 16:02:00 +00:00
motd update 2022-06-19 16:02:00 +00:00
README.md update 2022-07-03 08:39:12 +00:00
security-default.png update 2022-06-19 16:02:00 +00:00
shmsetup.sh update 2022-06-19 16:02:00 +00:00
sshd_config update 2022-07-03 08:31:36 +00:00
sysctl.conf update 2022-06-19 16:02:00 +00:00

logo

Welcome to SecurityVPS 👋

Version License: GPLv3

Security Default VPS Debian 11 / Guide by Свободный Волк ;)

Создаем ключи ssh (Пароль должен быть стойким)

~$ ssh-keygen -a 32 -t rsa -b 4096 -C 'libre'

Копируем наши созданные ключи на тачку

~$ ssh-copy-id root@195.0.0.201

Коннектимся к нашей тачке

~$ ssh root@195.0.0.201

Обновляем нашу тачку

~$ apt update && apt upgrade -y
~$ apt -y install sudo whois curl mc git autoconf make tcpdump \
   tree screen htop tree apt-transport-https neofetch net-tools macchanger \
   debsums debsecan fail2ban rkhunter ufw unattended-upgrades

Включить автоматическое обновление

~$ apt update && apt -y dist-upgrade
~$ dpkg-reconfigure --priority=low unattended-upgrades

Редактируем наш баннер

~$ nano /etc/motd

Редактируем наш issue на Windows Server

~$ echo 'Windows Server 2016' > /etc/issue.net

Создаем нового юзера для входа из под него

~$ adduser libre
~$ usermod -aG sudo libre
~$ reboot

В отдельном терминале копируем ключи для нового юзера

~$ ssh-copy-id libre@195.0.0.201

Коннектимся к нашей тачке

~$ ssh root@195.0.0.201

Install linux libre linux-libre-5.18

~$ sudo -i

~$ apt update && apt -y upgrade

~$ apt -y install gpgv2 nano curl wget

~$ wget -O - https://mirror.cyberbits.eu/linux-libre/freesh/archive-key.asc | sudo apt-key add -

~$ echo 'deb https://mirror.cyberbits.eu/linux-libre/freesh/ freesh main' >> /etc/apt/sources.list

~$ apt update

~$ apt -y install linux-libre-5.18 linux-libre-5.18-headers

~$ apt autoremove ; reboot

Protect Grub

Этот скрипт позволяет пользователям защитить загрузчик grub от компрометации и установить на него уровень безопасности.
~$ git clone https://git.disroot.org/librewolf/grubProtect 

~$ cd grubProtect && chmod +x grubProtect.sh

~$ sudo ./grubProtect.sh

Редактируем наш sshd config

# https://man.openbsd.org/sshd_config.5

~$ sshd -T 

~$ nano /etc/ssh/sshd_config

Заменяем на: sshd_config

# перезагружаем sshd

~$ service sshd reload

Редактируем наш sysctl.conf

~$ nano /etc/sysctl.conf

Заменяем на: sysctl.conf

~$ sysctl -p

Удалить все ключи Диффи-Хеллмана длиной менее 3072 бит

~$ sudo cp --archive /etc/ssh/moduli /etc/ssh/moduli-COPY-$(date +"%Y%m%d%H%M%S")
~$ sudo awk '$5 >= 3071' /etc/ssh/moduli | sudo tee /etc/ssh/moduli.tmp
~$ sudo mv /etc/ssh/moduli.tmp /etc/ssh/moduli

Создаем конфиг для удобного коннекта

Host libre
User libre
port 1337
HostName 195.0.0.201
MACs hmac-sha2-512
KexAlgorithms curve25519-sha256@libssh.org
VisualHostKey no
IdentityFile ~/.ssh/id_rsa

~$ nano ~/.ssh/config

~$ chmod 644 ~/.ssh/config

Блокировка учетной записи root

~$ passwd -l root

Коннектимся к нашей тачке

~$ ssh libre@195.0.0.201

Закройте не нужные порты если они есть

~$ sudo ss -tulpn

Установите Rkhunter

Отредактируйте /etc/rkhunter.conf файл с помощью nano

#Enable the mirror checks.
UPDATE_MIRRORS=1

#Tells rkhunter to use any mirror.
MIRRORS_MODE=0

#Specify a command which rkhunter will use when downloading files from the Internet
WEB_CMD=""

~$ sed -i -r -e '/^#|^$/ d' /etc/rkhunter.conf
~$ sudo nano /etc/rkhunter.conf
~$ sudo rkhunter -C
~$ sudo rkhunter --update
~$ sudo rkhunter --propupd 
~$ sudo rkhunter --check --sk 

Installation Lynis

~$ cd /usr/local
~$ git clone https://github.com/CISOfy/lynis
~$ cd lynis
~$ ./lynis audit system --quick

TODO:

  • Add script autoInstall
  • Add Firewall configuration
  • Add Traffic Noisy
  • More Security
  • ClamAV

Author

👤 Librewolf

Show your support

Give a if this project helped you!

License

Distributed under the GPL V3 License. See LICENSE for more information