[Bug 258990] [PATCH] security/acme.sh: Fix $DEFAULT_INSTALL_HOME

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 07 Oct 2021 19:50:15 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258990

            Bug ID: 258990
           Summary: [PATCH] security/acme.sh: Fix $DEFAULT_INSTALL_HOME
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: dvl@FreeBSD.org
          Reporter: jlduran@gmail.com
             Flags: maintainer-feedback?(dvl@FreeBSD.org)
          Assignee: dvl@FreeBSD.org

Created attachment 228504
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=228504&action=edit
security/acme.sh: Fix $DEFAULT_INSTALL_HOME

This is more a request for comments from the maintainer/community, than a bug
report:

While facing an issue, best described here:

https://github.com/acmesh-official/acme.sh/issues/3724

The solution was to set a preferred chain[1], by running:

    # su -l acme -c "acme.sh --set-default-chain --preferred-chain ISRG
--server letsencrypt"

However --and this is where I might get this port wrong-- I believe the idea is
that you could also run acme.sh as root and get the same result.

The problem is acme.sh defines $DEFAULT_INSTALL_HOME as $HOME/.$PROJECT_NAME.

If acme.sh is executed as root, it will use root's $HOME as part of
$DEFAULT_INSTALL_HOME, and files created under that path will be ignored.

For example, when issuing:

    # acme.sh --set-default-chain --preferred-chain ISRG --server letsencrypt

To set the preferred chain, a new $_DEFAULT_CA_CONF file under

    /root/.acme.sh/ca/$_ACME_SERVER_HOST/$_ACME_SERVER_PATH/ca.conf

with the contents "DEFAULT_PREFERRED_CHAIN='ISRG'" will be created, instead of
appending to

    /var/db/acme/.acme.sh/ca/$_ACME_SERVER_HOST/$_ACME_SERVER_PATH/ca.conf

While this can be avoided by su'ing as acme, given the hard-coded nature of
acme's $HOME, I believe it's better to patch $DEFAULT_INSTALL_HOME to prevent
foot-shootings. What do you think?

[1]: https://github.com/acmesh-official/acme.sh/wiki/Preferred-Chain

-- 
You are receiving this mail because:
You are the assignee for the bug.