sscg icon indicating copy to clipboard operation
sscg copied to clipboard

Support creating multiple certificates from a single private CA

Open sgallagher opened this issue 7 years ago • 5 comments

There may be times when we want to create several certificates at once (for example for a test-cluster of machines). SSCG should be able to take a configuration file (INI? YAML? JSON?) describing the different subject definitions for these certificates.

sgallagher avatar Mar 04 '17 11:03 sgallagher

Would be an awesome feature!

jamescassell avatar Nov 27 '18 21:11 jamescassell

@jamescassell I haven't done this yet because I'm wary of sscg getting as complex as the openssl CLI tool, but I'd happily look into it if you have some suggestions on an input format that is fairly approachable.

sgallagher avatar Nov 27 '18 21:11 sgallagher

A good workaround with the existing functionality is to just use the SAN list and copy the same key to all the hosts that need it.

jamescassell avatar Nov 30 '18 21:11 jamescassell

@sgallagher (I was just looking for this myself now) -- another alternative that might be easier would be up-front generation with a single CA, but multiple target certs. Perhaps using -- as a separator, could you parse arguments given multiple times and generate multiple certs as a result?

$ sscg \
    -- --subject-alt-name='IP:127.0.0.1/255.0.0.0' --cert-file=/path/to/1.pem --cert-key-file=/path/to/1.key \
    -- --subject-alt-name='IP:127.0.0.2/255.0.0.0' --cert-file=/path/to/2.pem --cert-key-file=/path/to/2.key \
    -- --client-file=alex.pem --client-key-file=alex.key --email '[email protected]' \
    -- --client-file=bob.pem --client-key-file=bob.key --email '[email protected]'

This has the added benefit of CA key destruction by default, rather than having to persist it. CA cert options could only allowed once (to simplify the logic), but otherwise the rest might be fairly doable after restructuring argument parsing? Just an idea :-)

cipherboy avatar Feb 02 '22 14:02 cipherboy

That's an interesting suggestion. Definitely would require a significant rework of the argument parser.

I'll look into that in the near future.

sgallagher avatar Feb 02 '22 14:02 sgallagher