Instalacja Wireguard dla OpenVZ

Jak zainstalować Wireguard dla OpenVZ lub KVM

Instalacja Wireguard dla OpenVZ

OpenVZ

Instalacja na Debian 10 64bit Minimal

apt-get update && apt-get upgrade -y && apt-get autoremove -y
apt-get install ca-certificates
wget https://git.io/wireguard -O wireguard-install.sh && bash wireguard-install.sh

lub

wget --no-check-certificate https://git.io/wireguard -O wireguard-install.sh && bash wireguard-install.sh

Instalujemy narzędzia sieciowe

apt-get install dnsutils

Instalujemu unbound

apt-get install unbound unbound-host -y
curl -o /var/lib/unbound/root.hints https://www.internic.net/domain/named.cache
chown unbound:unbound /var/lib/unbound/root.hints

Konfiguracja unbound.

nano /etc/unbound/unbound.conf
server:
  num-threads: 4

  #Enable logs
  verbosity: 1

  #list of Root DNS Server
  root-hints: "/var/lib/unbound/root.hints"

  #Respond to DNS requests on all interfaces
  interface: 0.0.0.0
  max-udp-size: 3072

  #Authorized IPs to access the DNS Server
  access-control: 0.0.0.0/0                 refuse
  access-control: 127.0.0.1                 allow
  access-control: 10.10.69.0/24         allow

  #not allowed to be returned for public internet  names
  private-address: 10.10.69.0/24

  # Hide DNS Server info
  hide-identity: yes
  hide-version: yes

  #Limit DNS Fraud and use DNSSEC
  harden-glue: yes
  harden-dnssec-stripped: yes
  harden-referral-path: yes

  #Add an unwanted reply threshold to clean the cache and avoid when possible a DNS Poisoning
  unwanted-reply-threshold: 10000000

  #Have the validator print validation failures to the log.
  val-log-level: 1

  #Minimum lifetime of cache entries in seconds
  cache-min-ttl: 1800 

  #Maximum lifetime of cached entries
  cache-max-ttl: 14400
  prefetch: yes
  prefetch-key: yes

Wyłączamy resolved w systemd

sudo systemctl disable systemd-resolved
sudo systemctl stop systemd-resolved

Właczamy unbound

systemctl enable unbound
systemctl start unbound

Sprawdzamy poprawność instalacji. Powinnismy otrzymać informację w sekcjach QUESTION SECTION oraz ANSWER SECTION.

dig tvn24.pl @127.0.0.1 -p 53

Testujemy poprawność DNSSEC.

dig sigfail.verteiltesysteme.net @127.0.0.1 -p 53

Powinien zwrócić status SERVFAIL i nie powinno być danych w sekcji ANSWER SECTION.

Następnie

dig sigok.verteiltesysteme.net @127.0.0.1 -p 53

Powinien zwrócić status NOERROR oraz dane w sekcji ANSWER SECTION.

KVM

curl -O https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh
chmod +x wireguard-install.sh
./wireguard-install.sh