Garret, On 10/4/20 14:04, Garret Wilson wrote: > Hi, everyone. I'm back already. (I had intended to leave the list to > focus my efforts elsewhere, but … here I am again.) > > I just realized there is a big SSL problem for small applications, and I > want to fix it. First a little review of where we are. > > Servlet containers are becoming less important and less desirable in > today's world, because we don't want to deploy and maintain some sort of > high-level container infrastructure (in the Java EE container sense, not > the Docker sense) just to deploy an application in it. Modern > distributed micrososervice applications have a bunch of > service/worker/agent application that are identical and redundant. You > spin up as many as you need; if some go down, you (or an orchestrator) > spins up others.
Microservices won't work the way you want with Let's Encrypt. You have two options: 1. Hit Let's Encrypt every time you launch a new instance of the microservice to deploy a new certificate 2. Handle the certificate provisioning elsewhere (e.g. ELB) #1 just won't work. LE won't re-issue a certificate more frequently than every 6 weeks or something like that. So that really leaves you with #2. What you really want is for the orchestrator to provide the certificate and key to the nodes as they come on-line. This represents a bit of a security issue, but not any moreso than any node trying to connect to the orchestrator in the first place IMHO. So instead of trying to get LE to work with Tomcat (which does work, but requires some care and feeding), maybe we should try to get Tomcat to load its crypto material from other places. One way to do that would be with e.g. Amazon's key storage service. I'm not familiar with that. I know it can store various types of keys; not sure about certificates and if we can pull a private key out of it. Honestly, your best bet would probably be to use ELB and just pay for it. You only pay for data-transfer, so a dormant ELB costs you virtually nothing. Instead of spinning-up an EC2 instance for your service, maybe you should be looking at Lambda instead. You can probably get your costs down more that way than trying to eliminate the ELB. BTW, if your instance isn't running at all (e.g. the orchestrator has decided that zero nodes are required), what do clients contact to make that initial connection for the orchestrator to spin-up that first instance? > For this reason libraries like Spring Boot allow you to deploy your Java > application as a standalone JAR with embedded Tomcat. The JAR represents > the completely independent application. You just throw it on a node and > it runs and provides a web server or whatever. So we we should be able > to throw a Spring Boot JAR on something like AWS Elastic Beanstalk and > it just runs. I found out it is far from that simple, and SSL is one of > the major problems. > > There seem to be two ways to get SSL support. On something like AWS > Elastic Beanstalk, you deploy a load balancer in front of your EC > instances. Elastic Beanstalk will (using the AWS Route 53 DNS) configure > SSL to the load balancer, spin up EC instances as needed (each running > your standalone JAR), and connect the load balancer to the EC instances, > all in a (sort of) automated fashion. But note that the SSL endpoint is > the load balancer, and the load balancer costs money! Even if you're > just running just a single standalone JAR instance requiring a single EC > instance, that load balancer sits there and drains cash. Significant > cash if you just want to run a little program with SSL support. > > What's the other option to deploy a standalone JAR? Configure an AWS EC > instance (or a VM with another provider), configure certbot, configure > Tomcat, save some files locally on the machine, etc. All this manual > work. I just want to run the standalone JAR! In short, if I have a > standalone program I want to run, I either have to configure and > maintain a VM like I did in the year 2000, or get into the nightmare of > Kubernetes-like orchestration with the endless configurations and/or the > high costs. > > I propose to create a module that integrates with embedded Tomcat that: > > 1. You indicate what domain you're hosting for (as part of the > application configuration or as an environment variable when > deployed, for example). > 2. When your application starts running, it automatically connects to > Let's Encrypt using RFC 8555 (or whatever is needed) and requests a > certificate, based upon the IP address it's running on. > 3. The module exposes the correct HTTP paths and/or connects to a > configured DNS as needed for validation. > 4. The module receives the certificates and caches them in memory or in > a temporary file as needed and provides them to Tomcat; Tomcat now > is serving using SSL/TLS. > 5. If the application dies, who cares? You start up another one. It > automatically does the same thing (on another machine or wherever it > is running) and the application is running SSL/TLS. It's that > simple. You don't need to run certbot. You don't need to manually > copy files on the system. You don't even need to know where the > application is going to run. You just need an executable JAR with > this new module, and you run it. Done. > 6. (Many variations exists where multiple JARs are running but one is > the "leader" for Let's Encrypt, and they communicate and share the > cashed certificate until the node dies. Or there are variations > using Docker. The first step is the radical one, and then all sorts > of possibilities open up.) > > From glancing over the Let's Encrypt docs and having had hands-on > experience embedding Tomcat, that seems completely doable to me. And I'm > ready to start. > > But first, what work has been done in this area already? I'm aware of > Chris' slides from 2018, but those techniques require some combination > of certbot, keytool, non-embedded Tomcat, symlinks,OS scripts, manually > file system manipulation, etc. I think at ApacheCon 2019 Chris mentioned > some more work has been done on this, but I don't recall where it was. > > Please point me to the latest work and ideas for Tomcat+Let's Encrypt so > that I don't spend two months doing something that is already been done, > or before I find out it is impossible. This exists. Romain Manni-Bucau from the TomEE project has one, and there are probably others. https://github.com/rmannibucau/letsencrypt-manager YMMV if you want to re-launch a Tomcat docker image every few hours. > As it stands I want fully automated SSL/TLS configuration just by > running a standalone JAR, and I don't see that existing anywhere. I'm > not prepared to pay AWS for a load balancer just to run a little app, > and I got tired of manual Linux setup and scripts and general sysadmin > work around 20 years ago. It's the cloud. It should act like the cloud. -chris --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org