IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Administration système Discussion :

OpenVpn + Apache2


Sujet :

Administration système

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre à l'essai
    Homme Profil pro
    Administrateur réseau en herbe
    Inscrit en
    Mars 2023
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 25
    Localisation : France, Lozère (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Administrateur réseau en herbe

    Informations forums :
    Inscription : Mars 2023
    Messages : 6
    Par défaut OpenVpn + Apache2
    Bon voici mon cas de figure:

    J'ai un serveur dédié sur Internet avec 2 services:
    1) Openvpn
    2) Serveur Web (Apache2)

    Le tout fonctionne correctement:
    Mes Clients via un fichier .ovpn se connectent normalement; Leur ip publique sur le web se font remplacer par celle sur Srv OpenVpn, en passant par l'interface tun0 via la passerelle 10.8.0.1 (Srv).
    Le serveur web fonctionne aussi correctement.

    Le seul petit soucis c'est lorsque je suis connecté via le Vpn et que j'accède au site web qui est sur ce même serveur. Ma connection change de route et ne passe plus par mon tunel tun0.
    ça ne le fait que pour ce site.

    J'ai fait un traceroute en tapant le nom de domaine, puis un autre avec l'ip du serveur web:
    au lieu de passer par 10.8.0.1 (paserelle Vpn), il passe par ma passerelle locale (192.168.1.1).
    les logs du serveur web me confirment aussi que j'utilise mon ip publique.

    Le problème viens donc du fait que ces 2 services "partagent" la même ip je suppose.
    Ya t il un moyen à mettre en place du coté serveur ou sur les fichiers .ovpn pour remédier à cela?

    Mon serveur tourne sous debian 11


    Merci à vous d'avance!

  2. #2
    Expert confirmé
    Avatar de becket
    Profil pro
    Informaticien multitâches
    Inscrit en
    Février 2005
    Messages
    2 854
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Informaticien multitâches
    Secteur : Service public

    Informations forums :
    Inscription : Février 2005
    Messages : 2 854
    Par défaut
    Salut,

    Si tu ne donnes pas :

    - Configuration iptables du serveur
    - Configuration openvpn du serveur
    - Fichier de configuration sur le client

    Cela va être compliqué de savoir ce qu'il se passe

  3. #3
    Membre à l'essai
    Homme Profil pro
    Administrateur réseau en herbe
    Inscrit en
    Mars 2023
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 25
    Localisation : France, Lozère (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Administrateur réseau en herbe

    Informations forums :
    Inscription : Mars 2023
    Messages : 6
    Par défaut
    Salut Becket,

    J'avais simplifié mon post pour que cela soit le plus clair possible.
    En réalité mes deux services sont sur une même VM via KVM/Quemu. Le cas de figure est le même pour les accès aux autres services http présents sur une autre VM sur ce meme srv. (vérification via les logs: mon ip publique apparait)
    mais cela n'a pas vraiment d'importance car j'ai testé cette config sur une autre machine (sans VM) et j'ai le même problème.

    Pour l'IPtables du serveur (hyperviseur):
    chaque service passe par une NAT pas de firewall sur mes VM car tout est bloqué en amont via celui de l'hyperviseur
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    4    DNAT       tcp  --  anywhere              tcp dpt:https to:192.168.122.15:443
    5    DNAT       udp  --  anywhere             udp dpt:openvpn to:192.168.122.15:1194

    Config du serveur:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
     
    local 192.168.122.15
    port 1194
    proto udp
    dev tun
    ca ca.crt
    cert server.crt
    key server.key
    dh dh.pem
    auth SHA512
    tls-crypt tc.key
    topology subnet
    server 10.8.0.0 255.255.255.0
    push "redirect-gateway def1 bypass-dhcp"
    ifconfig-pool-persist ipp.txt
    push "dhcp-option DNS 1.1.1.1"
    push "dhcp-option DNS 1.0.0.1"
    push "block-outside-dns"
    keepalive 10 120
    cipher AES-256-CBC
    user nobody
    group nogroup
    persist-key
    persist-tun
    verb 3
    crl-verify crl.pem
    explicit-exit-notify
    Config .ovpn du client (sans les certifs):
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
     
    client
    dev tun
    proto udp
    remote 212.32.XXX.XXX 1194
    resolv-retry infinite
    nobind
    persist-key
    persist-tun
    remote-cert-tls server
    auth SHA512
    cipher AES-256-CBC
    ignore-unknown-option block-outside-dns
    verb 3
    ...
    Certifs
    ...
    iptables -L donne:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
     
    Chain INPUT (policy DROP)
    target     prot opt source               destination         
    LIBVIRT_INP  all  --  anywhere             anywhere            
    f2b-sshd   tcp  --  anywhere             anywhere             multiport dports ssh
    ufw-before-logging-input  all  --  anywhere             anywhere            
    ufw-before-input  all  --  anywhere             anywhere            
    ufw-after-input  all  --  anywhere             anywhere            
    ufw-after-logging-input  all  --  anywhere             anywhere            
    ufw-reject-input  all  --  anywhere             anywhere            
    ufw-track-input  all  --  anywhere             anywhere            
     
    Chain FORWARD (policy DROP)
    target     prot opt source               destination         
    ACCEPT     all  --  anywhere             192.168.122.0/24     state NEW,RELATED,ESTABLISHED
    LIBVIRT_FWX  all  --  anywhere             anywhere            
    LIBVIRT_FWI  all  --  anywhere             anywhere            
    LIBVIRT_FWO  all  --  anywhere             anywhere            
    ufw-before-logging-forward  all  --  anywhere             anywhere            
    ufw-before-forward  all  --  anywhere             anywhere            
    ufw-after-forward  all  --  anywhere             anywhere            
    ufw-after-logging-forward  all  --  anywhere             anywhere            
    ufw-reject-forward  all  --  anywhere             anywhere            
    ufw-track-forward  all  --  anywhere             anywhere            
     
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination         
    LIBVIRT_OUT  all  --  anywhere             anywhere            
    ufw-before-logging-output  all  --  anywhere             anywhere            
    ufw-before-output  all  --  anywhere             anywhere            
    ufw-after-output  all  --  anywhere             anywhere            
    ufw-after-logging-output  all  --  anywhere             anywhere            
    ufw-reject-output  all  --  anywhere             anywhere            
    ufw-track-output  all  --  anywhere             anywhere            
     
    Chain LIBVIRT_FWI (1 references)
    target     prot opt source               destination         
    ACCEPT     all  --  anywhere             192.168.122.0/24     ctstate RELATED,ESTABLISHED
    REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable
     
    Chain LIBVIRT_FWO (1 references)
    target     prot opt source               destination         
    ACCEPT     all  --  192.168.122.0/24     anywhere            
    REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable
     
    Chain LIBVIRT_FWX (1 references)
    target     prot opt source               destination         
    ACCEPT     all  --  anywhere             anywhere            
     
    Chain LIBVIRT_INP (1 references)
    target     prot opt source               destination         
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain
    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:domain
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootps
    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:67
     
    Chain LIBVIRT_OUT (1 references)
    target     prot opt source               destination         
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain
    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:domain
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootpc
    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:68
     
    Chain f2b-sshd (1 references)
    target     prot opt source               destination         
    RETURN     all  --  anywhere             anywhere            
     
    Chain ufw-after-forward (1 references)
    target     prot opt source               destination         
     
    Chain ufw-after-input (1 references)
    target     prot opt source               destination         
    ufw-skip-to-policy-input  udp  --  anywhere             anywhere             udp dpt:netbios-ns
    ufw-skip-to-policy-input  udp  --  anywhere             anywhere             udp dpt:netbios-dgm
    ufw-skip-to-policy-input  tcp  --  anywhere             anywhere             tcp dpt:netbios-ssn
    ufw-skip-to-policy-input  tcp  --  anywhere             anywhere             tcp dpt:microsoft-ds
    ufw-skip-to-policy-input  udp  --  anywhere             anywhere             udp dpt:bootps
    ufw-skip-to-policy-input  udp  --  anywhere             anywhere             udp dpt:bootpc
    ufw-skip-to-policy-input  all  --  anywhere             anywhere             ADDRTYPE match dst-type BROADCAST
     
    Chain ufw-after-logging-forward (1 references)
    target     prot opt source               destination         
    LOG        all  --  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "
     
    Chain ufw-after-logging-input (1 references)
    target     prot opt source               destination         
    LOG        all  --  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "
     
    Chain ufw-after-logging-output (1 references)
    target     prot opt source               destination         
     
    Chain ufw-after-output (1 references)
    target     prot opt source               destination         
     
    Chain ufw-before-forward (1 references)
    target     prot opt source               destination         
    ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
    ACCEPT     icmp --  anywhere             anywhere             icmp destination-unreachable
    ACCEPT     icmp --  anywhere             anywhere             icmp time-exceeded
    ACCEPT     icmp --  anywhere             anywhere             icmp parameter-problem
    ACCEPT     icmp --  anywhere             anywhere             icmp echo-request
    ufw-user-forward  all  --  anywhere             anywhere            
     
    Chain ufw-before-input (1 references)
    target     prot opt source               destination         
    ACCEPT     all  --  anywhere             anywhere            
    ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
    ufw-logging-deny  all  --  anywhere             anywhere             ctstate INVALID
    DROP       all  --  anywhere             anywhere             ctstate INVALID
    ACCEPT     icmp --  anywhere             anywhere             icmp destination-unreachable
    ACCEPT     icmp --  anywhere             anywhere             icmp time-exceeded
    ACCEPT     icmp --  anywhere             anywhere             icmp parameter-problem
    ACCEPT     icmp --  anywhere             anywhere             icmp echo-request
    ACCEPT     udp  --  anywhere             anywhere             udp spt:bootps dpt:bootpc
    ufw-not-local  all  --  anywhere             anywhere            
    ACCEPT     udp  --  anywhere             224.0.0.251          udp dpt:mdns
    ACCEPT     udp  --  anywhere             239.255.255.250      udp dpt:1900
    ufw-user-input  all  --  anywhere             anywhere            
     
    Chain ufw-before-logging-forward (1 references)
    target     prot opt source               destination         
     
    Chain ufw-before-logging-input (1 references)
    target     prot opt source               destination         
     
    Chain ufw-before-logging-output (1 references)
    target     prot opt source               destination         
     
    Chain ufw-before-output (1 references)
    target     prot opt source               destination         
    ACCEPT     all  --  anywhere             anywhere            
    ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
    ufw-user-output  all  --  anywhere             anywhere            
     
    Chain ufw-logging-allow (0 references)
    target     prot opt source               destination         
    LOG        all  --  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW ALLOW] "
     
    Chain ufw-logging-deny (2 references)
    target     prot opt source               destination         
    RETURN     all  --  anywhere             anywhere             ctstate INVALID limit: avg 3/min burst 10
    LOG        all  --  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "
     
    Chain ufw-not-local (1 references)
    target     prot opt source               destination         
    RETURN     all  --  anywhere             anywhere             ADDRTYPE match dst-type LOCAL
    RETURN     all  --  anywhere             anywhere             ADDRTYPE match dst-type MULTICAST
    RETURN     all  --  anywhere             anywhere             ADDRTYPE match dst-type BROADCAST
    ufw-logging-deny  all  --  anywhere             anywhere             limit: avg 3/min burst 10
    DROP       all  --  anywhere             anywhere            
     
    Chain ufw-reject-forward (1 references)
    target     prot opt source               destination         
     
    Chain ufw-reject-input (1 references)
    target     prot opt source               destination         
     
    Chain ufw-reject-output (1 references)
    target     prot opt source               destination         
     
    Chain ufw-skip-to-policy-forward (0 references)
    target     prot opt source               destination         
    DROP       all  --  anywhere             anywhere            
     
    Chain ufw-skip-to-policy-input (7 references)
    target     prot opt source               destination         
    DROP       all  --  anywhere             anywhere            
     
    Chain ufw-skip-to-policy-output (0 references)
    target     prot opt source               destination         
    ACCEPT     all  --  anywhere             anywhere            
     
    Chain ufw-track-forward (1 references)
    target     prot opt source               destination         
     
    Chain ufw-track-input (1 references)
    target     prot opt source               destination         
     
    Chain ufw-track-output (1 references)
    target     prot opt source               destination         
    ACCEPT     tcp  --  anywhere             anywhere             ctstate NEW
    ACCEPT     udp  --  anywhere             anywhere             ctstate NEW
     
    Chain ufw-user-forward (1 references)
    target     prot opt source               destination         
     
    Chain ufw-user-input (1 references)
    target     prot opt source               destination         
    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:1854
     
    Chain ufw-user-limit (0 references)
    target     prot opt source               destination         
    LOG        all  --  anywhere             anywhere             limit: avg 3/min burst 5 LOG level warning prefix "[UFW LIMIT BLOCK] "
    REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable
     
    Chain ufw-user-limit-accept (0 references)
    target     prot opt source               destination         
    ACCEPT     all  --  anywhere             anywhere            
     
    Chain ufw-user-logging-forward (0 references)
    target     prot opt source               destination         
     
    Chain ufw-user-logging-input (0 references)
    target     prot opt source               destination         
     
    Chain ufw-user-logging-output (0 references)
    target     prot opt source               destination         
     
    Chain ufw-user-output (1 references)
    target     prot opt source               destination
    Voilà voilà!

  4. #4
    Expert confirmé
    Avatar de becket
    Profil pro
    Informaticien multitâches
    Inscrit en
    Février 2005
    Messages
    2 854
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Informaticien multitâches
    Secteur : Service public

    Informations forums :
    Inscription : Février 2005
    Messages : 2 854
    Par défaut
    Il manque la configuration iptables du serveur

  5. #5
    Membre à l'essai
    Homme Profil pro
    Administrateur réseau en herbe
    Inscrit en
    Mars 2023
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 25
    Localisation : France, Lozère (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Administrateur réseau en herbe

    Informations forums :
    Inscription : Mars 2023
    Messages : 6
    Par défaut
    Ok je l'ai rajouté.
    Je ne l'avais pas mis car je pense que ce n'est pas lié au firewall, car pas de bloquage. Juste une mauvaise route.
    J'ai pensé à une solution qui consiterai à demander à mon provider d'avoir une ip supplémentaire afin de séparer les services.
    Mais bon ça entrainerai un surcout et surtout une reconfiguration de pas mal de choses. (à éviter)

    Je cherche donc la commande magique qui dit:
    une fois connecté au srv Vpn, passe par le tunel pour acceder au site web...

  6. #6
    Expert confirmé
    Avatar de becket
    Profil pro
    Informaticien multitâches
    Inscrit en
    Février 2005
    Messages
    2 854
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Informaticien multitâches
    Secteur : Service public

    Informations forums :
    Inscription : Février 2005
    Messages : 2 854
    Par défaut
    Et la table NAT ?

    Citation Envoyé par Dash2en1 Voir le message
    Ok je l'ai rajouté.
    Je ne l'avais pas mis car je pense que ce n'est pas lié au firewall, car pas de bloquage. Juste une mauvaise route.
    iptables ne fait pas que du filtrage. La partie NAT est cruciale pour comprendre ce qu'il se passe
    Même si c'est il est fort possible que ce soit la configuration du serveur WEB qui soit à l'origine du problème.


    Citation Envoyé par Dash2en1 Voir le message
    Je cherche donc la commande magique qui dit:
    une fois connecté au srv Vpn, passe par le tunel pour acceder au site web...
    Il n'y a pas de commande magique ...

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [apache2] mod_rewrite.c absent de apache2
    Par igorzup dans le forum Apache
    Réponses: 8
    Dernier message: 08/08/2005, 13h11
  2. apache2, php et telechargement au lieu de visionage
    Par igorzup dans le forum Apache
    Réponses: 21
    Dernier message: 13/07/2005, 15h50
  3. no installed service named "apache2"
    Par Batou dans le forum Apache
    Réponses: 4
    Dernier message: 16/05/2005, 07h47
  4. [apache2] Ne voit pas mon index.xhtml, penible
    Par jean christophe dans le forum Apache
    Réponses: 2
    Dernier message: 20/04/2005, 12h20
  5. [Apache2] erreur 10038, Win32DisableAcceptEx
    Par Eusebius dans le forum Apache
    Réponses: 5
    Dernier message: 05/07/2004, 20h31

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo