Cloudflared: Difference between revisions

Phobos (talk | contribs)
m updated steps for consistency
Phobos (talk | contribs)
m clarified steps 3
 
Line 11: Line 11:
$ nix-shell -p cloudflared
$ nix-shell -p cloudflared
</syntaxhighlight>You will need to log in to your Cloudflare account through the command line, the following command will open a web browser to allow you to log in:<syntaxhighlight lang="console">
</syntaxhighlight>You will need to log in to your Cloudflare account through the command line, the following command will open a web browser to allow you to log in:<syntaxhighlight lang="console">
$ cloudflared -- tunnel login
$ cloudflared tunnel login
</syntaxhighlight>You can use the link it provides on any machine that has a browser in order to get the needed cert.pem file.
</syntaxhighlight>You can use the link it provides on any machine that has a browser in order to get the needed cert.pem file.


Line 43: Line 43:
       "00000000-0000-0000-0000-000000000000" = {
       "00000000-0000-0000-0000-000000000000" = {
         credentialsFile = "${config.sops.secrets.cloudflared-creds.path}";
         credentialsFile = "${config.sops.secrets.cloudflared-creds.path}";
        default = "http_status:404";
       };
       };
     };
     };
Line 49: Line 48:
}|name=cloudflare_tunnel.nix|lang=nix}}
}|name=cloudflare_tunnel.nix|lang=nix}}
You can now use the Cloudflare dashboard to add your public hosts.
You can now use the Cloudflare dashboard to add your public hosts.
==== Declarative igress ====


However, if you would instead like to do so in your configuration file you may specify ingress rules in your configuration file.{{File|3={
However, if you would instead like to do so in your configuration file you may specify ingress rules in your configuration file.{{File|3={
Line 84: Line 86:
     };
     };
   };
   };
}|name=cloudflare_tunnel.nix|lang=nix}}
}|name=cloudflare_tunnel.nix|lang=nix}}Finally, create a CNAME record with the following command.<syntaxhighlight lang="console">
$ cloudflared tunnel route dns <your-tunnel> <your-public-domain>
</syntaxhighlight>
 
== Troubleshooting ==
== Troubleshooting ==