[Bug 280405] security/step-certificates: 'service step-ca configure' fails

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 22 Jul 2024 11:54:00 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280405

            Bug ID: 280405
           Summary: security/step-certificates: 'service step-ca
                    configure' fails
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: jason.mann@gmail.com
                CC: mw@wipp.bayern
                CC: mw@wipp.bayern
             Flags: maintainer-feedback?(mw@wipp.bayern)

I installed the step-certificates and step-cli packages on a
FreeBSD-14.1-RELEASE-amd64 system.

Following the installation, I performed the following actions:

- Added 'step_ca_enable="YES"' to /etc/rc.conf.local
- Ran 'service step-ca configure'

  root@filer ~]# service step-ca configure
  No configured Step CA found.
  Creating new one....
  open /usr/local/etc/step/ca/contexts.json failed: not a directory
  Step CA Password file for auto-start not found
  Creating it....
  Please enter the Step CA Password:

After entering a password, I could see that /usr/local/etc/step/password.txt
had been created, as well as a /usr/local/etc/step/ca file.

The service then could not be started:

  [root@filer ~]# service step-ca start
  Starting step_ca.
  step_ca is not running.

Judging by the "open /usr/local/etc/step/ca/contexts.json failed: not a
directory" error, that 'ca' file should instead be a directory.

I examined the /usr/local/etc/rc.d/step-ca RC script and found the following on
line 93:

  install -m 600 -o ${step_ca_user} -g ${step_ca_group} /dev/null
${step_ca_steppath}

It appears this line is missing a '-d' argument to create a directory and
instead creates a file.

I added the '-d' argument to the script on my system, deleted the
/usr/local/etc/step/ca and password.txt files, then re-ran 'service step-ca
configure' and got what looks like the correct outcome:

  [root@filer /usr/local/etc/step]# service step-ca configure
  No configured Step CA found.
  Creating new one....
  install: /dev/null exists but is not a directory
  ✔ Deployment Type: Standalone
  What would you like to name your new PKI?
  ✔ (e.g. Smallstep): [redacted]
  What DNS names or IP addresses will clients use to reach your CA?
  ✔ (e.g. ca.example.com[,10.1.2.3,etc.]): localhost
  What IP and port will your new CA bind to? (:443 will bind to 0.0.0.0:443)
  ✔ (e.g. :443 or 127.0.0.1:443): 127.0.0.1:8443
  What would you like to name the CA's first provisioner?
  ✔ (e.g. you@smallstep.com): [redacted]
  Choose a password for your CA keys and first provisioner.
  ✔ [leave empty and we'll generate one]: 
  ✔ Password: [redacted]

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