Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service disco: support for tls_skip_verify on nomad https checks #16213

Open
shoenig opened this issue Feb 17, 2023 · 3 comments
Open

service disco: support for tls_skip_verify on nomad https checks #16213

shoenig opened this issue Feb 17, 2023 · 3 comments

Comments

@shoenig
Copy link
Member

shoenig commented Feb 17, 2023

https://developer.hashicorp.com/nomad/docs/job-specification/check#tls_skip_verify

We should implement this flag for Nomad's native service discovery. Currently running into this myself while trying to use a local Caddy as a mock ACME server. The cert is signed only for localhost but Nomad only knows about the IP address (127.0.0.1) so I can't ever have a passing check due to the tls error.

caddy nomad job
job "caddy" {
  type = "service"

  group "group" {
    network {
      mode = "bridge"
      port "acme" {
        static = 6666
      }
    }

    service {
      name     = "acme"
      port     = "acme"
      provider = "nomad"
      check {
        name     = "alive"
        type     = "http"
        protocol = "https"
        path     = "/"
        interval = "10s"
        timeout  = "1s"
        tls_skip_verify = true
      }
    }

    task "caddy" {
      driver = "raw_exec"

      artifact {
        source      = "https://github.com/caddyserver/caddy/releases/download/v2.6.4/caddy_2.6.4_linux_amd64.tar.gz"
        destination = "local/"
      }

      template {
        data = <<EOH
          localhost:6666 {
            tls internal
            acme_server * {
              ca "local"
	            lifetime "1h"
            }
          }
          # make requests to
          # https://localhost:6666/acme/local/directory        
        EOH

        destination = "local/Caddyfile"
      }

      config {
        command = "local/caddy"
        args    = ["run", "--config", "local/Caddyfile"]
      }

      resources {
        cpu    = 100
        memory = 128
      }
    }
  }
}
nomad alloc checks b0
Status of 1 Nomad Service Checks

ID         =  9204a81827eeb24e4351132407199f2f
Name       =  alive
Group      =  caddy.group[0]
Task       =  (group)
Service    =  acme
Status     =  failure
Mode       =  healthiness
Timestamp  =  2023-02-17T11:51:03-06:00
Output     =  nomad: Get "https://127.0.0.1:6666/": remote error: tls: internal error

curl equivalent of the Nomad http check

/usr/bin/curl https://127.0.0.1:6666
curl: (35) error:0A000438:SSL routines::tlsv1 alert internal error

curl https://localhost:6666 works of course

/usr/bin/curl -w '%{response_code}' "https://localhost:6666"
200
@Antse
Copy link

Antse commented Mar 23, 2023

hello @shoenig 👋 , any update on that topic ?

@shoenig
Copy link
Member Author

shoenig commented Mar 23, 2023

Hi @Antse! We haven't done anything with this issue yet; it should be pretty easy to knock out though, if you need it 🙂

@Antse
Copy link

Antse commented Mar 23, 2023

Hi @Antse! We haven't done anything with this issue yet; it should be pretty easy to knock out though, if you need it 🙂

I mitigate this by using tcp check but this is very dirty :(

@tgross tgross modified the milestones: 1.5.x, 1.6.x Jun 23, 2023
@tgross tgross modified the milestones: 1.6.x, 1.7.x Oct 27, 2023
@tgross tgross modified the milestones: 1.7.x, 1.8.x Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants