tomeshnet / toronto-community-network

Organization, planning, and information related to Toronto's community network operation
https://tomesh.net/
21 stars 1 forks source link

Service - LetsEncrypt well-known proxy #95

Open darkdrgn2k opened 4 years ago

darkdrgn2k commented 4 years ago

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.

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

To Do

darkdrgn2k commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

Other refrences for this problem

https://communitynetworks.group/t/anyone-using-https-in-a-cn/286/22

https://hackmd.io/FVrdvDH3RsOQ4ge-7aA4eA