Forum OpenACS Development: Trying letsencrypt

Request notifications

Collapse
Posted by Raul Rodriguez on
I used letsencrypt (https://bitbucket.org/naviserver/letsencrypt) and came across a few things:

I tried it on a fresh install of naviserver and openacs on debian 9.
From the README, it was not clear if it could be used on a fresh install of naviserver/openacs. It was also not clear what directory the make install could be executed and if execution is needed when letencrypt.tcl is directly used in packages/acs-subsite/www/admin/.

I ended up executing it in /usr/local/src/.

I moved letsencrypt.tcl to packages/acs-subsite/www/admin.

The script failed due to permission problems on
/usr/local/ns/config-service0
and
/etc/ssl/openssl.cnf

After fixing this, it ran successfully; however, I was not able to get the server to start until I removed the following that had appeared at the end of the /usr/local/ns/config-service0:

ns_section ns/server/${server}/modules
ns_param nsssl nsssl.so

I also found that setting it to STAGING caused the site to go down since it created and udpated all the files with "staging" data. Please also note that regardless of running in production or staging mode, it backed up and updated /usr/local/ns/config-service0 from the standard oacs certificate path (/var/www/service0/etc/) to /usr/local/ns/modules/nsssl/.

Is it possible to have some suggestions on:
- should the certificate be moved to the standard oacs directory
- what should be done with the files that were generated in the process .csr,.conf,.key
- what to expect when running in Staging mode
- how to renew

Thank you

Collapse
2: Re: Trying letsencrypt (response to 1)
Posted by Gustaf Neumann on

Some preliminaries: Letsencrypt [1] is a Naviserver module, which obtains for a NaviServer with nsssl configured (running a TLS service) certificates. letsencrypt is a NaviServer module and not an OpenACS package, it works with and without OpenACS.

The letsencrypt module consists of a single file, which is called via browser. The configuration happens in the first part of the script [2]. When the script is executed, it uses the openssl binary and some Tcl packages (which should be available in all OpenACS installations). The script gets configuration values from the NaviServer/OpenACS config-file and from the OpenSSL configuration and writes some files (it produces a backup file of the old config file, produces a new config file, creates automatically a letsencrypt account, creates key pairs, creates certificate requests and obtains finally the requested certificates (potentially multi domain certificates). To write or update these files, nsd (usually running with user_id nsadmin, group_id nsadmin) needs write permissions on the "sslpath" (see [2]) and on the directory, where the OpenACS config file resides.

Note, that one letsencrypt account can be used for obtaining certificates of several (OpenACS) servers, so this information is kept under the matching NaviServer installation.

Concerning your questions:

  • "fresh installation of openacs or not": whatever "fresh" means: as the README file [1] states, it requires NaviServer 4.99.15 or newer. If you have an older version of NaviServer, you have to upgrade.
  • "executing it in /usr/local/src": Not sure, what you mean. "letsencrypt.tcl" is called via browser, "/usr/local/src is normally not in the directory tree served by nsd. As the README [1] suggests under OpenACS it is recommended to copy letsencrypt.tcl to packages/acs-subsite/www/admin/ such that it is reachable for all sub-sites.
  • "until I removed the following that had appeared ...": The script adds a driver section to the end of the config file, when there is no nsssl configuration found. You see this in the reply of the script, when it writes at the end "... adding driver module nsssl.so to your config file". So, my guess us as following: your site is not using native NaviServer nsssl, but you are probably using OpenACS behind some proxy performing the HTTPS unloading.
  • "staging" mode: this is a term from letsencrypt. The obtained certificate works with the limitations noted in [3].
  • "should the certificate be moved to the standard oacs directory": as noted, the module updates the config file, everything related to all letsencrypt certificates and accounts is stored at the same place (as indicated in the reply form the letsencrypt script). You are certainly free to copy the pem files around and/or make links.
  • "what ... be done with the files...": keep this files, these are your account data
  • "how to renew": run the same script again. For an nsd with nsssl, you get expiration date from the nsstats.tcl module

If my guess is right, and you are running behind a proxy, this is not a supported configuration. Maybe a lightweight approach would be to make a "behind proxy" variant, that does not touch the opencs config file.

[1] https://bitbucket.org/naviserver/letsencrypt/src/default/
[2] https://bitbucket.org/naviserver/letsencrypt/src/default/letsencrypt.tcl
[3] https://letsencrypt.org/docs/staging-environment/

Collapse
3: Re: Trying letsencrypt (response to 2)
Posted by Raul Rodriguez on
The following is a summary of what I did:
- Installed debian 9
- Installed naviserver and openacs using the scripts from git clone https://github.com/gustafn/install-ns
- [ns_info home]/modules/nsssl did not exist
- Downloaded letsencrypt https://bitbucket.org/naviserver/letsencrypt/downloads/
- Performed make install in /usr/local/src/naviserver-letsencrypt-a4c48260f300/
- Copied letsencrypt.tcl to /var/www/service0/packages/acs-subsite/www/admin/
- On my router, opened up ports 80 and 443 and port forward to openacs.
- Left 8443 commented out in my openacs install
- Opened up browser and logged in to openacs as admin
- Went to http://www.myopenacs.com/admin/letsencrypt
- Entered domain names
- Got permission Request Error
- Udpated permission on /etc/ssl/openssl.cnf and /usr/local/ns/config-service0
- Ran again
- Success
- nsssl and related documents were created and config-service0 was updated
- removed newly added 'ns_section ns/server/${server}/modules' and 'ns_param nsssl nsssl.so' from config file and uncommented https port
- restarted openacs
- site came up and was able to log on via https

Thank You for all of your work and help.