Bonjour, et meilleurs voeux à tous !
J'espère que ce sera compréhensible, mais pas trop indigeste car je suis vraiment bloqué depuis un bon bout de temps...
Contexte
Infrastructure : Je loue actuellement un serveur chez SoYouStart, pour me faire la main niveau réseau, système, etc., mais je rencontre un souci d'accès à mes sites web :
- Hyperviseur : Proxmox (porte une adresse IP publique)
- 3 VM : Rproxy, Web et Repo (gitlab)
- Rproxy (porte la deuxième adresse IP publique) :
- nginx
- fail2ban
- Web :
- Repo :
- 1 nom de domaine chez ovh
- 2 adresses IP publiques (voir au-dessus)
La VM Rproxy, ayant une adresse publique et une adresse privée, doit servir de firewall, reverse proxy pour les deux autres machines du LAN.
Configuration Machine RProxy
** IPTABLES ** :
deku > sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
deku > sudo iptables -L -t nat -n -v –lines-numbers
Chain PREROUTING (policy ACCEPT 1240K packets, 45M bytes)
num pkts bytes target prot opt in out source destination
1 127 6844 DNAT tcp -- ens18 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:2002 to:192.168.1.4:22
2 10820 646K DNAT tcp -- ens18 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:2022 to:192.168.1.3:22
Chain INPUT (policy ACCEPT 1236K packets, 45M bytes)
num pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 14476 packets, 899K bytes)
num pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 22183 packets, 1288K bytes)
num pkts bytes target prot opt in out source destination
1 12293 919K MASQUERADE all -- * ens18 0.0.0.0/0 0.0.0.0/0
2 10820 646K SNAT tcp -- * * 0.0.0.0/0 192.168.1.3 tcp dpt:22 to:IPPUBLIQUE
deku > sudo iptables -L -t filter
Chain INPUT (policy ACCEPT)
target prot opt source destination
f2b-sshd tcp -- anywhere anywhere multiport dports ssh
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain f2b-sshd (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere
** NGINX ** :
- Fichier du site web : /etc/nginx/sites-available/web-site.conf
server {
listen 80;
server_name domain.fr;
access_log /var/log/nginx/site_web-access.log;
error_log /var/log/nginx/site_web-error.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 30;
proxy_send_timeout 30;
proxy_pass http://192.168.1.4:8088/;
}
}
- Fichier GitLab : /etc/nginx/sites-available/gitlab.conf
server {
listen 80;
server_name gitlab.domain.fr;
access_log /var/log/nginx/gitlab-access.log;
error_log /var/log/nginx/gitlab-error.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 30;
proxy_send_timeout 30;
proxy_pass http://192.168.1.3:8081/;
}
}
- Fichier de configuration nginx :
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
** Fail2ban **
Le fichier, de mémoire n'a pas été modifié.
Configuration Machine Serveur HTTP
- Fichier de configuration de mon site /etc/apache2/site-availables/monsite.fr :
<VirtualHost *:8088>
ServerName www.domain.fr
ServerAlias domain.fr
ServerAdmin webmaster@localhost
DocumentRoot /srv/www/domain
<Directory /srv/www/domain>
Options Indexes FollowSymLinks
AllowOverride None
DirectoryIndex index.html
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
LogLevel info
</VirtualHost>
- Fichier de configuration ports.conf : /etc/apache2/ports.conf
Listen 8088
Configuration Machine GitLab
Configuration par défaut, tout est commenté, sauf :
external_url ‘http://gitlab.domain.fr’
Au cas-où : Les services nginx, gitlab et http sont running.
Si jamais l'un de vous est arrivé jusqu'ici et qu'il a une idée de test ou autres, je suis plus que preneur !!!
Merci d'avance à vous 😀