GithubHelp home page GithubHelp logo

atomjoy / vps Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 14.0 104 KB

Konfiguracja serwera VPS Debian 11 w ovh podstawy (ger).

Home Page: https://github.com/atomjoy/vps

Shell 100.00%
vps-debian vps-installation vps-security vps-server vps-setup vps-sshkeys certbot-ssl vps-postfix-send-only vps-ssl vps-ufw-firewall

vps's Introduction

Konfiguracja serwera VPS z sytemem Debian 11

Konfiguracja serwera VPS Debian 11 z ovh (LEMP, Letsencrypt certbot, logowanie z kluczami ssh, serwer smtp do wysyłania wiadomości email, ufw firewall).

Pobierz z git

sudo apt install git
git clone https://github.com/atomjoy/vps.git

Strefa DNS

Utwórz recordy A w strefie DNS dla hostów swojej domeny (certbot ssl):
hello.example.com 
www.hello.example.com

Uruchom jako root

# Utwórz hasło root
sudo passwd root

# Zaloguj jako root
su

# Zmień hasło użytkownika debian (opcjonalnie)
sudo passwd debian

Klucze ssh

# Utwórz klucz rsa ~/.ssh/id_rsa
ssh-keygen -t rsa -C "[email protected]"
ssh-keygen -t rsa -b 4096 -C "[email protected]"

# Utwórz klucz Ed25519 (można użyć do logowania na githuba np.)
ssh-keygen -t ed25519 -C "[email protected]"

# Wyślij na serwer
ssh-copy-id -i ~/.ssh/id_rsa.pub $vps_user@$vps_host_or_ip

Ustawienia serwera ssh

Logowanie tylko z kluczami ssh, bez hasła i logowania na root.

# Ustaw wcześniej klucze ssh dla zalogowanego użytkownika !!!
sudo bash ssh.sh

Uruchom skrypty jako root

Nie zapomij zmienić ustawienia w każdym skrypcie (variables) !!!

  1. sudo bash hostname.sh
  2. sudo bash ssl-snakeoil.sh
  3. sudo bash apt-https.sh
  4. sudo bash ufw.sh
  5. sudo bash php.sh
  6. sudo bash nginx.sh
  7. sudo bash certbot.sh
  8. sudo bash nginx-vhost.sh
  9. sudo bash postfix.sh
  10. sudo bash mariadb.sh
  11. sudo bash remove-sudo-default-user.sh

Usuwanie użytkownika debian z sudo

sudo bash remove-sudo-user.sh

Hostname

# Hostname
sudo hostnamectl set-hostname hello.example.com

# Change hosts etc/hosts
127.0.0.1 example.com hello.example.com hello localhost

Połączenia i certyfikaty

# Certyfikat snakeoil
sudo apt install ssl-cert

# Aktualizacja certyfikatu snakeoil
sudo make-ssl-cert generate-default-snakeoil --force-overwrite

# Podgląd certyfikatu ssl
openssl x509 -noout -subject -in /etc/ssl/certs/ssl-cert-snakeoil.pem

# Połącz z serwerem smtp :25 :578
openssl s_client -starttls smtp -crlf -connect 127.0.0.1:25

# Połącz z serwerem smtp
telnet localhost 25

# Test http/https
 wget --no-check-certificate https://example.com

Usuń linię zawierającą tekst z pliku

sed -i '/inet_interfaces/d' /etc/postfix/main.cf

Wyślij email z cmd

sudo apt install mailutils postfix

# Linux mail
echo "Test email `date`" | mail -s "Welcome today is `date`" [email protected]

# Linux mailx
echo "From test `date`" | mailx -s "From address test" -a 'From: Admin Root <[email protected]>' [email protected]

# With bash MAILNAME=example.com
echo "From test `date`" | mailx -s "Welcome message `date`" -a "From: Admin Root <root@${MAILNAME}>" $TESTMAIL

vps's People

Contributors

atomjoy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.