Giter Club home page Giter Club logo

Comments (7)

routerino avatar routerino commented on May 20, 2024

It seems odd that kubernetes would care that a container exposes lower ports, since the port mapping can be arbitrary. The container runs as an unprivileged user.

Yes, by default the container copies the Caddyfile to /data/Caddyfile, you can put in a custom one there to do whatever you like. You can see the startup script here and default Caddyfile here

I'll add an environment variable to change the port next release.

from headscale-ui.

lorenzo95 avatar lorenzo95 commented on May 20, 2024

Oh sorry, no. Kubernetes doesn't care about the port. It cares about the requirement of the root permission that is needed with any port under 1024.

Basically, a user without root privileges can't run caddy on port 443. That is no different from any other linux.
Kubernetes will go in and say... hey, this requires root privileges to run so I won't start your container.

I'll give a caddyfile a shot. If I get it working I'll post it.

from headscale-ui.

routerino avatar routerino commented on May 20, 2024

@lorenzo95 the new release is out now, can you set an env variable for a custom port and see if it fixes your problem? see here

from headscale-ui.

lorenzo95 avatar lorenzo95 commented on May 20, 2024

Not all the way yet, no.

It still opens port 80 for acme http verification. I disabled all that and moved the port. Here is my caddyfile that works with the kubernetes baseline security policy enforced:

http://{$DOMAIN}:8080 {
  tls {
	issuer acme {
	  disable_http_challenge
	  disable_tlsalpn_challenge
	}
  }
  redir / /web
  uri strip_prefix /web
  file_server {
	root /web
  }
}

And then I just pass DOMAIN as an env variable. There might be easier ways but it's my first time using caddy.
Of course self signed certs could stay enabled, that doesn't really interfere with anything.

Here is a link to what I keep referring to in case someone thinks I am crazy ;)
Pod Security Standards

from headscale-ui.

routerino avatar routerino commented on May 20, 2024

Not all the way yet, no.

It still opens port 80 for acme http verification. I disabled all that and moved the port. Here is my caddyfile that works with the kubernetes baseline security policy enforced:

http://{$DOMAIN}:8080 {
  tls {
	issuer acme {
	  disable_http_challenge
	  disable_tlsalpn_challenge
	}
  }
  redir / /web
  uri strip_prefix /web
  file_server {
	root /web
  }
}

And then I just pass DOMAIN as an env variable. There might be easier ways but it's my first time using caddy. Of course self signed certs could stay enabled, that doesn't really interfere with anything.

Here is a link to what I keep referring to in case someone thinks I am crazy ;) Pod Security Standards

Ah, I see. caddy opens up port 80 even if port 80 isn't being used by the configuration. That should be a simple adjustment, just default the HTTP port to 8080 and otherwise ignore it.

from headscale-ui.

routerino avatar routerino commented on May 20, 2024

Fixed with 657d929

from headscale-ui.

routerino avatar routerino commented on May 20, 2024

@lorenzo95 the new docker container can set ports for both http and https via environment variables, no custom caddyfile required.

from headscale-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.