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 - LetsEncrypt well-known proxy #95

Open
2 of 6 tasks
darkdrgn2k opened this issue Sep 10, 2020 · 3 comments
Open
2 of 6 tasks

Service - LetsEncrypt well-known proxy #95

darkdrgn2k opened this issue Sep 10, 2020 · 3 comments
Labels
network Network Planning, Design and Operations

Comments

@darkdrgn2k
Copy link
Contributor

darkdrgn2k commented Sep 10, 2020

This initial comment is collaborative and open to modification by all.

Task Summary

🎟️ Re-ticketed from: #
πŸ“… Due date: N/A
🎯 Success criteria: Deploy service to allow registered mesh nodes to request LetsEncrypt certificates securely.
πŸ‘ˆDepends on: #45

Service that allows the proxying of lets encrypt requests into the mesh to generate SSL certificates.

  • DNS wildcard on public facing DNS server (*.tcn.tomesh.net) points all requests to mesh nodes to a single public ip address
  • The IP address (above) is a public NGINX proxy that also exists on the mesh and on the internet
  • NGINX wildcard vhosts to accept request from ____.tcn.tomesh.net
  • Extract "subdomain" from request into a variable
  • NGINX shows a message to requests that the node is not accessible from the internet
  • NGINX proxy_passes .well-known request to the the FQDN that was requested
  • NGINX Proxy uses internal DNS resolver to resolve actual mesh ip addresses instead of the public one
  • The reqiest is proxied into the mesh to the correct node

This would create a transparent way for users on the mesh to generate SSL certificates for their nodes

  • Node must be registered with our DNS (so json file of some sort)
  • DHCP nodes may be problematic (maybe fix could be integrating DDNS with DHCP Servers?)

To Do

  • Write a proxy config
    • See if server_name regex can be changed to allow . notations and make it "tcn.tomesh.net" instead of "core.tcn.tomesh.net"
    • 404 redirect or similar to / to display message
  • Check if it works with lets encrypt
  • Spin up server
  • Cleanup
@darkdrgn2k
Copy link
Contributor Author

darkdrgn2k commented Sep 10, 2020

Proof of concept - nginx vhost

http://test22.core.tcn.tomesh.net - Generic site that displays message node is unreachable form the internet
http://test22.core.tcn.tomesh.net/.well-known/ - proxied request to an internal node

server {
        listen 80;
        listen [::]:80;
        root /var/www/tomesh;
        index index.php index.html index.htm index.nginx-debian.html;
        server_name  ~^(?<subdomain>[^.]+).core.tcn.tomesh.net;
        location /.well-known {
           resolver 100.64.21.12;
           proxy_pass http://$subdomain.core.tcn.tomesh.net;
        }

        location / {
        }
}

@darkdrgn2k
Copy link
Contributor Author

LetsEncrypt Test

root@Monitor:~# certbot --nginx
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): test@tomesh.net

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: a

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: n
No names were found in your configuration files. Please enter in your domain
name(s) (comma and/or space separated)  (Enter 'c' to cancel): test22.core.tcn.tomesh.net
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for test22.core.tcn.tomesh.net
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/default

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled
https://test22.core.tcn.tomesh.net

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=test22.core.tcn.tomesh.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/test22.core.tcn.tomesh.net/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/test22.core.tcn.tomesh.net/privkey.pem
   Your cert will expire on 2020-12-09. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

root@Monitor:~#

@darkdrgn2k darkdrgn2k added the network Network Planning, Design and Operations label Sep 12, 2020
@darkdrgn2k
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
network Network Planning, Design and Operations
Projects
None yet
Development

No branches or pull requests

2 participants