configuration proxy caddy

Started by lmornet, July 11, 2024, 08:32:50 PM

Previous topic - Next topic
Bonsoir,
débutant sur opnsense soyez indulgant
j'ai configurer une redirection de port wan >> lan
j'ai un nom de domaine ha.isell.fr je le ping de mon ordi
j'ai configuré caddy en suivante la documentaion
la verification réglage géneraux est validée
mais quand je me connecte sur ha.isell.fr j'obtiens une page blanche par contre elle est sécurisée rt je peux voir le certificat
dans le fichier journal de caddy j'ai cette erreur

"error","ts":"2024-07-11T18:14:30Z","logger":"http.log.access.419d795a-0fb6-41bd-bf0e-160b3500ad0b","msg":"handled request","request":{"remote_ip":"192.168.1.90","remote_port":"58726","client_ip":"192.168.1.90","proto":"HTTP/2.0","method":"GET","host":"ha.isell.fr","uri":"/config/dashboard","headers":{"Sec-Fetch-User":["?1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Priority":["u=1"],"Te":["trailers"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0"],"Accept-Language":["fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3"],"Accept-Encoding":["gzip, deflate, br, zstd"],"Sec-Fetch-Site":["none"]},"tls":{"resumed":false,"version":772,"cipher_suite":4867,"proto":"h2","server_name":"ha.isell.fr"}},"bytes_read":0,"user_id":"","duration":0.005032615,"size":0,"status":502,"resp_headers":{"Server":["Caddy"],"Alt-Svc":["h3=\":443\"; ma=2592000"]}}

je ne comprends pas  si vous pouvez m'aider
Merci


Je voudrais le Caddyfile.

Upstream Destination HTTPS ou HTTP?
Hardware:
DEC740

Bnjour,

voici le caddyfile:

# DO NOT EDIT THIS FILE -- OPNsense auto-generated file


# Global Options
{
   log {
      include http.log.access.419d795a-0fb6-41bd-bf0e-160b3500ad0b
      output net unixgram//var/caddy/var/run/log {
      }
      format json {
         time_format rfc3339
      }
      level DEBUG
   }

   email lucien.mornet@isell.fr
   grace_period 10s
   import /usr/local/etc/caddy/caddy.d/*.global
}

# Reverse Proxy Configuration


# Reverse Proxy Domain: "419d795a-0fb6-41bd-bf0e-160b3500ad0b"
*.isell.fr {
   log 419d795a-0fb6-41bd-bf0e-160b3500ad0b
   tls {
      dns infomaniak QmkOZo6dRShX1W7pH8-OHmSjXbqt5ydpJ5J8fU28iRRhtBLE0kaBn0YadtP-T1XvIukVm8_pMYNn9GiB
   }

   @48ed335f-ddb2-4d8c-9ca8-0769d64df27b {
      host ha.isell.fr
   }
   handle @48ed335f-ddb2-4d8c-9ca8-0769d64df27b {
      handle {
         reverse_proxy 192.168.1.6 {
         }
      }
   }
}

import /usr/local/etc/caddy/caddy.d/*.conf

je redirige sur http://192.168.1.6:8123

merci

July 12, 2024, 11:48:56 AM #3 Last Edit: July 12, 2024, 11:53:02 AM by Monviech
Revoke Infomaniak API key.

Handle:

- Upstream Destination: 192.168.1.6
- Upstream Port: 8123

Pour TLS (HTTPS) de Upstream Destination:
- TLS Insecure Skip Verify
Hardware:
DEC740

pourquoi  Révoquer la clé API Infomaniak. ?
il me faut un certicat pour ha.isell.fr
je me connecte en https sur ha.isell.fr
et je fait une redirection de port sur  192.168.1.6:8123
je me suis peu-être mal exprimer sur sur ma demande

July 12, 2024, 01:34:45 PM #5 Last Edit: July 12, 2024, 01:37:22 PM by Monviech
Sorry my french is not so good.

- Revoke the API Key, you might have posted the real one here, in the Caddyfile.
- You don't need Port Forwarding, disable the port forwarding rule.
- You only need Firewall Rule to Caddy, 80/443.

https://docs.opnsense.org/manual/how-tos/caddy.html
Hardware:
DEC740

j'ai déactiver la redirection de pourt mais le problème demeure
j'obtiens le certificat pour ha.isell.fr mais j'ai toujours l'erreur dans les log de caddy :

"error","ts":"2024-07-12T14:16:21Z","logger":"http.log.access.419d795a-0fb6-41bd-bf0e-160b3500ad0b","msg":"handled request","request":{"remote_ip":"192.168.1.90","remote_port":"43398","client_ip":"192.168.1.90","proto":"HTTP/2.0","method":"GET","host":"ha.isell.fr","uri":"/","headers":{"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Accept-Encoding":["gzip, deflate, br, zstd"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Site":["none"],"Priority":["u=1"],"Te":["trailers"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0"],"Accept-Language":["fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-User":["?1"]},"tls":{"resumed":true,"version":772,"cipher_suite":4867,"proto":"h2","server_name":"ha.isell.fr"}},"bytes_read":0,"user_id":"","duration":0.000486207,"size":0,"status":502,"resp_headers":{"Server":["Caddy"],"Alt-Svc":["h3=\":443\"; ma=2592000"]}}

quand je me connecte sur https://ha.isell.fr  , j'obtiens une page blanche

July 12, 2024, 04:30:34 PM #7 Last Edit: July 12, 2024, 04:39:49 PM by lmornet
régles LAN




ma page blanche  https///ha.isell.fr
on constate que la page est bien sécurisé avec le certificat

No port 8123 in config?

handle @48ed335f-ddb2-4d8c-9ca8-0769d64df27b {
      handle {
         reverse_proxy 192.168.1.6 {   <---- no port here, empty port means port 80 is used.
         }
Hardware:
DEC740

comment je fait pour mettre le port 8123
merci

c'est un domaine générique *.isell.fr (wildcard ) et tous mes sous domaine son rediriger ver le port parent *.isell.fr
donc mon sous domaine ha.isell.fr a le port du domaine générique *.isell.fr (80, 443)
c'est bien ca ?
donc comment faire pour un port différent ?
avec NAT ?
merci

July 12, 2024, 06:32:23 PM #13 Last Edit: July 12, 2024, 06:48:14 PM by Monviech
https://docs.opnsense.org/manual/how-tos/caddy.html#creating-a-simple-reverse-proxy

Handler
Domain: *.isell.fr
Subdomain: ha.isell.fr
Upstream Domain: 192.168.1.6
Upstream Port: 8123
Hardware:
DEC740

super ca marche  :)
merci beaucoup
bonne soirée