r/tinycorelinux • u/GnPQGuTFagzncZwB • Feb 18 '24
acme.sh and tinycore and lighttpd
So I have been using tinycore and lighttpd for a long time now, they work great and are small and fast. I wanted to get encrypted though as some of the browsers got aggressive for a while about just good ol http pages. If you want a free cert you have one choice and that is let's encrypt. Zerossl lies about being free, you find that out on your fourth renewal and from what I have read they have an awful reputation for leaving your credit card alone when you are done with them. Let's encrypt forces you to use automation though. I got this https://github.com/acmesh-official/acme.sh acme client to work.
My situation may be tougher than most as I am running on really odd iron, and old Wise thin client that has a whopping 128MB, yea MB SSD in it. I keep the web site on a USB stick, but the OS and all the guts live on the SSD. The USB stick is normally mounted RO. I do have a half gig of ram on the thing though.
So one day of running the thing the progress I made was you have to tell it to use lets encrypt now as apparently zerossl got them to switch the defaults. To change them you need to run this:
acme.sh --set-default-ca --server letsencrypt
After a bunch of go founds after that I figured out the script to get certs put something in the web root they could pick up, so with the webroot being RO that did not work so well. I actually had another domain I only used for email so I set that up to work out of my home directory just to get the bugs out. The command you want to run is:
acme.sh --issue --domain foo.com --webroot /path_to_webroot
So I ran my head into walls with this for a couple of days before looking at the console debug noise and the script. The first thing I saw was it was giving wget, I did not have curl installed, options the busybox flavor that comes stock with lacks. So tce-ab and get wget. Still no love though, next it seems that the busyox sed is lacking too. Great. I am almost out of space on the tiny ssd. That made more noise go away. Finally after looking at the script, it seemed like it always wanted to use curl first, ,before wget, so I removed wget and installed curl. BINGO! Got my cert!
You have to cat the key file and the cer file into a pem file but that is fast and easy, and edit your config file and kick the service and you should be good to go. One warning, do not be a dumbass like me and forget to do a filetool.sh and save all your stuff. I had it down and kicked it just to have a fresh start and poof, my ssl certs were gone, as were all my edits and notes. My own fault. I was able to request the cert again (one posting said you had to wait a week, but they may have felt sorry for me.. Learn from my mistake though and back them up someplace else. I sshed them to my wundows machine just in case..
I also mounted my USB stick RW and ran it for those sites and everything fell right into place. They have a cron tab entry that will auto fetch the certs and a bunch of server entries for putting the stuff in place etc. I did not see one for lighttpd, but I did not spend a long time looking. I may just hack the apache one.
Anyway if you have been skinning your knees with the acme client, make sure any pieces it uses are NOT the busybox ones.
View all comments
Show parent comment
1
u/GnPQGuTFagzncZwB Feb 19 '24
Thank you for hanging with me through this! I really appreciate it, and you clearly have this stuff mastered.
So, looking back at the example reminded me of something I had forgot, I started with the exact cut and paste from the quickstart. Normally I do not log anything but I did take the comment out for logging errors and I was getting noise that ssl.privkey was an unknown keyword, I removed those lines and things still seem to work. So I may have an older version of lighttpd.
BTW, if you work with that group, that is a very underrated piece of software. I used to use apache, and it worked but it was big, and until I moved away from it and tried lightttpd I thought it was fast, but man, the change was very very noticeable. I don't know why it does not have more of a market share. It really rocks on one slow hardware.