technische_naslag:sid:roer
Verschillen
Dit geeft de verschillen weer tussen de geselecteerde revisie en de huidige revisie van de pagina.
Volgende revisie | Vorige revisie | ||
technische_naslag:sid:roer [2025/02/28 18:32] – aangemaakt michelle | technische_naslag:sid:roer [2025/06/01 22:11] (huidige) – [Lynis] michelle | ||
---|---|---|---|
Regel 7: | Regel 7: | ||
* OS: Debian GNU/Linux 12 (" | * OS: Debian GNU/Linux 12 (" | ||
- | ==== Installatie en Configuratie ==== | + | ===== Installatie en Configuratie |
- | In ieder geval een webserver. | + | ==== Webserver: Apache2 ==== |
+ | |||
+ | Met Let's Encrypt certificaat: | ||
* [[https:// | * [[https:// | ||
+ | |||
+ | ==== OpenVPN ==== | ||
+ | |||
+ | Hiervoor gebruik ik een handig scrippie: [[https:// | ||
+ | Download het geval en maak het executable: | ||
+ | |||
+ | <code bash> | ||
+ | curl -O https:// | ||
+ | chmod +x openvpn-install.sh | ||
+ | </ | ||
+ | |||
+ | Voer het uit en gebruik het meest de defaults: | ||
+ | |||
+ | <code bash> | ||
+ | michelle@roer: | ||
+ | Welcome to the OpenVPN installer! | ||
+ | The git repository is available at: https:// | ||
+ | |||
+ | I need to ask you a few questions before starting the setup. | ||
+ | You can leave the default options and just press enter if you are okay with them. | ||
+ | |||
+ | I need to know the IPv4 address of the network interface you want OpenVPN listening to. | ||
+ | Unless your server is behind NAT, it should be your public IPv4 address. | ||
+ | IP address: 192.168.1.2 | ||
+ | |||
+ | It seems this server is behind NAT. What is its public IPv4 address or hostname? | ||
+ | We need it for the clients to connect to the server. | ||
+ | Public IPv4 address or hostname: roer.vlet.net | ||
+ | |||
+ | Checking for IPv6 connectivity... | ||
+ | |||
+ | Your host appears to have IPv6 connectivity. | ||
+ | |||
+ | Do you want to enable IPv6 support (NAT)? [y/n]: n | ||
+ | |||
+ | What port do you want OpenVPN to listen to? | ||
+ | 1) Default: 1194 | ||
+ | 2) Custom | ||
+ | 3) Random [49152-65535] | ||
+ | Port choice [1-3]: 1 | ||
+ | |||
+ | What protocol do you want OpenVPN to use? | ||
+ | UDP is faster. Unless it is not available, you shouldn' | ||
+ | 1) UDP | ||
+ | 2) TCP | ||
+ | Protocol [1-2]: 1 | ||
+ | |||
+ | What DNS resolvers do you want to use with the VPN? | ||
+ | 1) Current system resolvers (from / | ||
+ | 2) Self-hosted DNS Resolver (Unbound) | ||
+ | 3) Cloudflare (Anycast: worldwide) | ||
+ | 4) Quad9 (Anycast: worldwide) | ||
+ | 5) Quad9 uncensored (Anycast: worldwide) | ||
+ | 6) FDN (France) | ||
+ | 7) DNS.WATCH (Germany) | ||
+ | 8) OpenDNS (Anycast: worldwide) | ||
+ | 9) Google (Anycast: worldwide) | ||
+ | 10) Yandex Basic (Russia) | ||
+ | 11) AdGuard DNS (Anycast: worldwide) | ||
+ | 12) NextDNS (Anycast: worldwide) | ||
+ | 13) Custom | ||
+ | DNS [1-12]: 1 | ||
+ | |||
+ | Do you want to use compression? | ||
+ | Enable compression? | ||
+ | |||
+ | Do you want to customize encryption settings? | ||
+ | Unless you know what you're doing, you should stick with the default parameters provided by the script. | ||
+ | Note that whatever you choose, all the choices presented in the script are safe (unlike OpenVPN' | ||
+ | See https:// | ||
+ | |||
+ | Customize encryption settings? [y/n]: n | ||
+ | |||
+ | Okay, that was all I needed. We are ready to setup your OpenVPN server now. | ||
+ | You will be able to generate a client at the end of the installation. | ||
+ | Press any key to continue... | ||
+ | Geraakt:1 http:// | ||
+ | Geraakt:2 http:// | ||
+ | Ophalen:3 http:// | ||
+ | 55,4 kB opgehaald in 0s (139 kB/ | ||
+ | Pakketlijsten worden ingelezen... Klaar | ||
+ | Pakketlijsten worden ingelezen... Klaar | ||
+ | Boom van vereisten wordt opgebouwd... Klaar | ||
+ | De statusinformatie wordt gelezen... Klaar | ||
+ | ca-certificates is reeds de nieuwste versie (20230311). | ||
+ | gnupg is reeds de nieuwste versie (2.2.40-1.1). | ||
+ | 0 opgewaardeerd, | ||
+ | Pakketlijsten worden ingelezen... Klaar | ||
+ | Boom van vereisten wordt opgebouwd... Klaar | ||
+ | De statusinformatie wordt gelezen... Klaar | ||
+ | openvpn is reeds de nieuwste versie (2.6.3-1+deb12u3). | ||
+ | iptables is reeds de nieuwste versie (1.8.9-2). | ||
+ | openssl is reeds de nieuwste versie (3.0.16-1~deb12u1). | ||
+ | wget is reeds de nieuwste versie (1.21.3-1+deb12u1). | ||
+ | ca-certificates is reeds de nieuwste versie (20230311). | ||
+ | curl is reeds de nieuwste versie (7.88.1-10+deb12u12). | ||
+ | 0 opgewaardeerd, | ||
+ | --2025-05-26 22: | ||
+ | Herleiden van github.com (github.com)... 140.82.121.4 | ||
+ | Verbinding maken met github.com (github.com)|140.82.121.4|: | ||
+ | HTTP-verzoek is verzonden; wachten op antwoord... 302 Found | ||
+ | Locatie: https:// | ||
+ | --2025-05-26 22: | ||
+ | Herleiden van objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133, | ||
+ | Verbinding maken met objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|: | ||
+ | HTTP-verzoek is verzonden; wachten op antwoord... 200 OK | ||
+ | Lengte: 68984 (67K) [application/ | ||
+ | Wordt opgeslagen als: ‘/ | ||
+ | |||
+ | / | ||
+ | |||
+ | 2025-05-26 22:09:41 (9,87 MB/s) - ' | ||
+ | |||
+ | |||
+ | Notice | ||
+ | ------ | ||
+ | ' | ||
+ | |||
+ | Your newly created PKI dir is: | ||
+ | * / | ||
+ | |||
+ | * Using Easy-RSA configuration: | ||
+ | |||
+ | * The preferred location for ' | ||
+ | To silence this message move your ' | ||
+ | or declare your ' | ||
+ | |||
+ | * Using x509-types directory: / | ||
+ | |||
+ | |||
+ | * Using SSL: openssl OpenSSL 3.0.16 11 Feb 2025 (Library: OpenSSL 3.0.16 11 Feb 2025) | ||
+ | |||
+ | * Using Easy-RSA configuration: | ||
+ | |||
+ | * The preferred location for ' | ||
+ | To silence this message move your ' | ||
+ | or declare your ' | ||
+ | Using configuration from / | ||
+ | ----- | ||
+ | |||
+ | Notice | ||
+ | ------ | ||
+ | CA creation complete and you may now import and sign cert requests. | ||
+ | Your new CA certificate file for publishing is at: | ||
+ | / | ||
+ | |||
+ | * Using SSL: openssl OpenSSL 3.0.16 11 Feb 2025 (Library: OpenSSL 3.0.16 11 Feb 2025) | ||
+ | |||
+ | * Using Easy-RSA configuration: | ||
+ | |||
+ | * The preferred location for ' | ||
+ | To silence this message move your ' | ||
+ | or declare your ' | ||
+ | ----- | ||
+ | |||
+ | Notice | ||
+ | ------ | ||
+ | Keypair and certificate request completed. Your files are: | ||
+ | req: / | ||
+ | key: / | ||
+ | Using configuration from / | ||
+ | Check that the request matches the signature | ||
+ | Signature ok | ||
+ | The Subject' | ||
+ | commonName | ||
+ | Certificate is to be certified until May 24 20:09:42 2035 GMT (3650 days) | ||
+ | |||
+ | Write out database with 1 new entries | ||
+ | Database updated | ||
+ | |||
+ | Notice | ||
+ | ------ | ||
+ | Certificate created at: | ||
+ | * / | ||
+ | |||
+ | Notice | ||
+ | ------ | ||
+ | Inline file created: | ||
+ | * / | ||
+ | |||
+ | * Using SSL: openssl OpenSSL 3.0.16 11 Feb 2025 (Library: OpenSSL 3.0.16 11 Feb 2025) | ||
+ | |||
+ | * Using Easy-RSA configuration: | ||
+ | |||
+ | * The preferred location for ' | ||
+ | To silence this message move your ' | ||
+ | or declare your ' | ||
+ | Using configuration from / | ||
+ | |||
+ | Notice | ||
+ | ------ | ||
+ | An updated CRL has been created. | ||
+ | CRL file: / | ||
+ | |||
+ | 2025-05-26 22:09:42 DEPRECATED OPTION: The option --secret is deprecated. | ||
+ | 2025-05-26 22:09:42 WARNING: Using --genkey --secret filename is DEPRECATED. | ||
+ | * Applying / | ||
+ | * Applying / | ||
+ | * Applying / | ||
+ | * Applying / | ||
+ | * Applying / | ||
+ | kernel.pid_max = 4194304 | ||
+ | net.ipv4.ip_forward = 1 | ||
+ | fs.protected_fifos = 1 | ||
+ | fs.protected_hardlinks = 1 | ||
+ | fs.protected_regular = 2 | ||
+ | fs.protected_symlinks = 1 | ||
+ | |||
+ | Tell me a name for the client. | ||
+ | The name must consist of alphanumeric character. It may also include an underscore or a dash. | ||
+ | Client name: MichelleJanse | ||
+ | |||
+ | Do you want to protect the configuration file with a password? | ||
+ | (e.g. encrypt the private key with a password) | ||
+ | 1) Add a passwordless client | ||
+ | 2) Use a password for the client | ||
+ | Select an option [1-2]: 1 | ||
+ | |||
+ | * Using SSL: openssl OpenSSL 3.0.16 11 Feb 2025 (Library: OpenSSL 3.0.16 11 Feb 2025) | ||
+ | |||
+ | * Using Easy-RSA configuration: | ||
+ | |||
+ | * The preferred location for ' | ||
+ | To silence this message move your ' | ||
+ | or declare your ' | ||
+ | ----- | ||
+ | |||
+ | Notice | ||
+ | ------ | ||
+ | Keypair and certificate request completed. Your files are: | ||
+ | req: / | ||
+ | key: / | ||
+ | Using configuration from / | ||
+ | Check that the request matches the signature | ||
+ | Signature ok | ||
+ | The Subject' | ||
+ | commonName | ||
+ | Certificate is to be certified until May 24 20:09:49 2035 GMT (3650 days) | ||
+ | |||
+ | Write out database with 1 new entries | ||
+ | Database updated | ||
+ | |||
+ | Notice | ||
+ | ------ | ||
+ | Certificate created at: | ||
+ | * / | ||
+ | |||
+ | Notice | ||
+ | ------ | ||
+ | Inline file created: | ||
+ | * / | ||
+ | Client MichelleJanse added. | ||
+ | |||
+ | The configuration file has been written to / | ||
+ | Download the .ovpn file and import it in your OpenVPN client. | ||
+ | </ | ||
+ | |||
+ | Vervolgens moet ik op mijn **Fritz!Box** wel deze **poort openen** natuurlijk! | ||
+ | Daarna nog wat eigen aanpassingen gedaan aan de server config: | ||
+ | |||
+ | <code bash> | ||
+ | michelle@roer: | ||
+ | ##server 10.8.0.0 255.255.255.0 | ||
+ | server 192.168.3.0 255.255.255.0 | ||
+ | push " | ||
+ | push "route 192.168.1.0 255.255.255.0" | ||
+ | ##push " | ||
+ | </ | ||
+ | |||
+ | En klaar is Kees. Oh nee: **klaar is de oudste dochter van Kees!!** | ||
+ | |||
+ | ===== Hardening ===== | ||
+ | |||
+ | Nadat de functionaliteit erin zit mag er ook nog wel aan de veiligheid gedaan worden. Want Debian GNU/Linux is out-of-the-box wel aardig in elkaar gestoken maar het kan nog altijd beter! | ||
+ | |||
+ | ==== Lynis ==== | ||
+ | |||
+ | Een tooltje om de hardening van het systeem te scannen en met adviezen te komen. Geen daemon maar een check van mijn systeem: kan er qua veiligheid nog wat verbeterd worden? De versie in Debian GNU/Linux loopt achter dus een aparte repo toegevoegd, zoals beschreven op [[https:// | ||
+ | |||
+ | <code bash> | ||
+ | root@roer: | ||
+ | root@roer: | ||
+ | deb [arch=amd64, | ||
+ | </ | ||
+ | |||
+ | Daarna een scan draaien: | ||
+ | |||
+ | <code bash> | ||
+ | root@roer: | ||
+ | </ | ||
+ | |||
+ | Een malware scanner had ik nog niet, dus..... | ||
+ | |||
+ | === Extra packages === | ||
+ | |||
+ | <code bash> | ||
+ | root@roer: | ||
+ | </ | ||
+ | |||
+ | === Permissies === | ||
+ | |||
+ | <code bash> | ||
+ | sudo chmod o-rwx /home/* | ||
+ | </ | ||
+ | |||
+ | en in <code bash>/ | ||
+ | |||
+ | === Blacklist rare modules === | ||
+ | |||
+ | <code bash> | ||
+ | michelle@lummel: | ||
+ | install dccp /bin/true | ||
+ | install sctp /bin/true | ||
+ | install rds /bin/true | ||
+ | install tipc /bin/true | ||
+ | </ | ||
+ | |||
+ | === Purge restanten van packages === | ||
+ | |||
+ | Er slingeren soms nog configuratie-bestanden en andere cruft rond van packages die allang niet meer op het systeem staan. Die herken je in de output van `dpkg -l` doordat ze beginnen met rc. Mik deze weg: | ||
+ | |||
+ | <code bash> | ||
+ | michelle@roer: | ||
+ | libpython3.10-minimal: | ||
+ | </ | ||
+ | ==== AppArmor ==== | ||
+ | |||
+ | ** ToDo ** |
technische_naslag/sid/roer.1740763979.txt.gz · Laatst gewijzigd: 2025/02/28 18:32 door michelle