Skip to content

Support ECF_SSL configuration for uw ecflow server#933

Open
AnnaSmoot-NOAA wants to merge 9 commits into
ufs-community:mainfrom
AnnaSmoot-NOAA:ecf_server_924
Open

Support ECF_SSL configuration for uw ecflow server#933
AnnaSmoot-NOAA wants to merge 9 commits into
ufs-community:mainfrom
AnnaSmoot-NOAA:ecf_server_924

Conversation

@AnnaSmoot-NOAA

@AnnaSmoot-NOAA AnnaSmoot-NOAA commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator
  • Add _check_ssl_named() helper to verify that a named certificate triplet (<host>.<port>.crt/.key/.pem) exists in $HOME/.ecflowrc/ssl before starting the server
  • Update server() to route to _check_ssl_named() when ECF_SSL is a <host>.<port> string, and to _provision_ssl() for the default case (boolean or absent)
  • Fix inline comment and JSON schema description for ECF_SSL: the string form is a <host>.<port> prefix, not a certificate file path
  • Fix docs (yaml/ecflow.rst, cli/tools/ecflow.rst): replace incorrect file-path examples with <host>.<port> examples; clarify that all cert files must reside in $HOME/.ecflowrc/ssl
  • Update existing SSL string test to use <host>.<port> format; add tests for _check_ssl_named() (all files present, missing files)

Closes #924

Synopsis

Adds proper support for the ECF_SSL config key in uw ecflow server. When ECF_SSL is absent or true, the default certificate triplet (server.crt/server.key/dh2048.pem) is auto-provisioned in $HOME/.ecflowrc/ssl. When ECF_SSL is a <host>.<port> string, the named triplet (<host>.<port>.crt/.key/.pem) is verified to exist there before the server starts. When ECF_SSL is false or --insecure is given, SSL is disabled entirely. All cert files must reside in $HOME/.ecflowrc/ssl; no custom directory is supported by ecflow.

Type

  • Bug fix (corrects a known issue)
  • Code maintenance (refactoring, etc. without behavior change)
  • Documentation
  • Enhancement (adds new functionality)
  • Tooling (CI, code-quality, packaging, revision-control, etc.)

Impact

  • This is a breaking change (changes existing functionality)
  • This is a non-breaking change (existing functionality continues to work as expected)

Checklist

  • I have added myself and any co-authors to the PR's Assignees list.
  • I have reviewed the documentation and have made any updates necessitated by this change.
  • Where helpful, I have written comments in this PR's Files changed view to assist reviewers.

…cflow server

- Add ECF_SSL_DIR as optional key in the ecflow server JSON schema
- Refactor _provision_ssl() to accept optional ssl_dir parameter,
  falling back to $HOME/.ecflowrc/ssl when None
- Update server() to read ECF_SSL_DIR from config and pass it to
  _provision_ssl(); key passes through to ecflow_server/client env
- Update existing SSL tests to pass ssl_dir directly instead of patching
  the module-level constant
- Add tests for custom ssl_dir forwarding and env passthrough
- Add Server Configuration section to YAML docs covering ECF_SSL_DIR
- Add CLI example for ECF_SSL_DIR usage and update --report JSON example

Closes ufs-community#924
@AnnaSmoot-NOAA AnnaSmoot-NOAA self-assigned this Jun 17, 2026
@AnnaSmoot-NOAA AnnaSmoot-NOAA marked this pull request as ready for review June 17, 2026 19:09
Copilot AI review requested due to automatic review settings June 17, 2026 19:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for configuring a custom ecFlow SSL certificate directory for uw ecflow server via the optional ECF_SSL_DIR setting, while preserving the existing default behavior when unset.

Changes:

  • Extend the ecFlow server config JSON schema to allow ECF_SSL_DIR.
  • Refactor SSL provisioning to accept an optional ssl_dir and wire ECF_SSL_DIR through server() into provisioning + server environment.
  • Update/add unit tests and user documentation to cover the new configuration option and CLI examples.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/uwtools/ecflow.py Adds _SSL_DEFAULT_DIR, refactors _provision_ssl(ssl_dir=...), and passes ECF_SSL_DIR from config into provisioning and env.
src/uwtools/resources/jsonschema/ecflow.jsonschema Adds ECF_SSL_DIR as an optional server configuration key.
src/uwtools/tests/test_ecflow.py Updates SSL provisioning tests to pass ssl_dir directly; adds server tests for forwarding + env passthrough.
docs/sections/user_guide/yaml/ecflow.rst Documents the new ecflow: server: block section and ECF_SSL_DIR.
docs/sections/user_guide/cli/tools/ecflow.rst Adds CLI usage example for ECF_SSL_DIR and updates --report JSON example.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/uwtools/ecflow.py Outdated
Comment thread docs/sections/user_guide/yaml/ecflow.rst Outdated
Comment thread src/uwtools/resources/jsonschema/ecflow.jsonschema Outdated
Comment thread docs/sections/user_guide/cli/tools/ecflow.rst Outdated
…r SSL generation

Replace shell-string openssl calls with subprocess.run(list, check=False) to
eliminate shell injection risk. Use os.umask(0o077)/restore in a try/finally
instead of a shell umask prefix. Resolve the openssl executable via
shutil.which() to satisfy S607 and fail fast if openssl is absent. Fix docs
wording on --insecure behavior. Add test for _openssl() not-found branch.
Comment thread src/uwtools/ecflow.py Outdated
Comment thread src/uwtools/ecflow.py Outdated
Comment thread docs/sections/user_guide/yaml/ecflow.rst Outdated
- Shorten ECF_SSL_DIR description in JSON schema
- Change _openssl() return type from str to Path
- Switch SSL subprocess calls from subprocess_run to run_shell_cmd for consistency with uwtools conventions; embed umask 077 in shell command for thread safety
- Correct docs: ECF_SSL_DIR is a uwtools config key, not a native ecFlow variable; remove incorrect claims about ecflow_client inheritance
- Fix ecflow_client description: ecflow → ecFlow (capitalization)
- Update tests to patch run_shell_cmd instead of subprocess_run
Comment thread docs/sections/user_guide/cli/tools/ecflow.rst Outdated
Comment thread src/uwtools/ecflow.py Outdated
@AnnaSmoot-NOAA AnnaSmoot-NOAA changed the title Support configurable SSL certificate directory (ECF_SSL_DIR) for uw ecflow server Support ECF_SSL configuration for uw ecflow server Jun 22, 2026

@maddenp-cu maddenp-cu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be more updates related to the semantics of ECF_SSL needed, but these caught my eye.

Comment thread docs/sections/user_guide/yaml/ecflow.rst Outdated
Comment thread docs/sections/user_guide/yaml/ecflow.rst Outdated
Comment thread docs/sections/user_guide/yaml/ecflow.rst Outdated

@maddenp-cu maddenp-cu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for your patience and persistence implementing this tricky feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support configurable SSL certificate directory for uw ecflow server

4 participants