Add batch/non-interactive CLI mode to Perl and Python ssl-admin#12
Open
Add batch/non-interactive CLI mode to Perl and Python ssl-admin#12
Conversation
Both implementations now accept subcommands for non-interactive use: ssl-admin create-sign --cn jdoe ssl-admin revoke --cn jdoe ssl-admin gen-crl ssl-admin server --cn webserver --overwrite ssl-admin options --days 730 --size 4096 Supported subcommands mirror every interactive menu item: options, create-csr, sign, create-sign, revoke, renew, view-crl, index, inline, zip, dh, new-ca, server, gen-crl (plus the legacy 'crl' alias) Python uses argparse; Perl uses Getopt::Long with positional command extraction. A central yn_prompt_or_default() helper returns preset values in batch mode or prompts interactively otherwise. Sleeps and recursive main_menu() calls are suppressed in batch mode. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add a Batch Mode section covering subcommands, common options, usage examples, and a cron example for automated CRL regeneration. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
create-sign,revoke,gen-crl,server,options, etc.) plus the legacycrlaliasyn_prompt_or_default()helper returns preset values in batch mode or falls back to interactive prompts — minimal diff against existing menu logicmain_menu()calls are suppressed in batch mode so scripts exit cleanlyargparsewith subparsers; parser built once and reused for--helpand dispatchGetopt::Longwith positional command extraction viaspliceExample usage
Test plan
ssl-admin --helpandssl-admin create-sign --help— verify help text prints without requiring a config filessl-admin create-sign --cn testuseragainst an initialized CA directory — verify cert is created non-interactivelyssl-admin revoke --cn testuser— verify revocation and CRL regenerationssl-admin gen-crl— verify CRL is updated and script exits 0ssl-admin create-sign --cn existingwhen cert exists without--overwrite— verify non-zero exit with clear errorcd tests && pytest -v🤖 Generated with Claude Code