···11+{ config, lib, pkg, ... }:
22+let
33+ inherit (lib)
44+ mkOption
55+ types
66+ ;
77+88+ cfg = config.virtualisation.podman.networkSocket;
99+1010+in
1111+{
1212+ options.virtualisation.podman.networkSocket = {
1313+ enable = mkOption {
1414+ type = types.bool;
1515+ default = false;
1616+ description = ''
1717+ Make the Podman and Docker compatibility API available over the network
1818+ with TLS client certificate authentication.
1919+2020+ This allows Docker clients to connect with the equivalents of the Docker
2121+ CLI <code>-H</code> and <code>--tls*</code> family of options.
2222+2323+ For certificate setup, see https://docs.docker.com/engine/security/protect-access/
2424+2525+ This option is independent of <xref linkend="opt-virtualisation.podman.dockerSocket.enable"/>.
2626+ '';
2727+ };
2828+2929+ server = mkOption {
3030+ type = types.enum [];
3131+ description = ''
3232+ Choice of TLS proxy server.
3333+ '';
3434+ example = "ghostunnel";
3535+ };
3636+3737+ openFirewall = mkOption {
3838+ type = types.bool;
3939+ default = false;
4040+ description = ''
4141+ Whether to open the port in the firewall.
4242+ '';
4343+ };
4444+4545+ tls.cacert = mkOption {
4646+ type = types.path;
4747+ description = ''
4848+ Path to CA certificate to use for client authentication.
4949+ '';
5050+ };
5151+5252+ tls.cert = mkOption {
5353+ type = types.path;
5454+ description = ''
5555+ Path to certificate describing the server.
5656+ '';
5757+ };
5858+5959+ tls.key = mkOption {
6060+ type = types.path;
6161+ description = ''
6262+ Path to the private key corresponding to the server certificate.
6363+6464+ Use a string for this setting. Otherwise it will be copied to the Nix
6565+ store first, where it is readable by any system process.
6666+ '';
6767+ };
6868+6969+ port = mkOption {
7070+ type = types.port;
7171+ default = 2376;
7272+ description = ''
7373+ TCP port number for receiving TLS connections.
7474+ '';
7575+ };
7676+ listenAddress = mkOption {
7777+ type = types.str;
7878+ default = "0.0.0.0";
7979+ description = ''
8080+ Interface address for receiving TLS connections.
8181+ '';
8282+ };
8383+ };
8484+8585+ config = {
8686+ networking.firewall.allowedTCPPorts =
8787+ lib.optional (cfg.enable && cfg.openFirewall) cfg.port;
8888+ };
8989+9090+ meta.maintainers = lib.teams.podman.members ++ [ lib.maintainers.roberth ];
9191+}