testssl.sh icon indicating copy to clipboard operation
testssl.sh copied to clipboard

[Feature request] Support `--outprefix` for output files with explicit filename

Open polarathene opened this issue 4 years ago • 2 comments

Is your feature request related to a problem? Please describe. Running tests via a call to testssl.sh and a common commands file for the --file option which sets --jsonfile-pretty (for determinstic filenames, as opposed to the dynamic filename with date) for each lines command output.

That becomes a problem when running multiple tests runs but with different output directories for the json files.

  • Eg, a service supports multiple TLS configs which affects the available cipher suites. testssl .sh command is the same for each TLS config test, other than the desired output location/prefix.

Describe the solution you'd like There is an existing --outprefix but it seems to be ignored when a specific filename is assigned. I would like to use this to provide a directory path as the prefix, or a similar option for where output should be placed.

--outprefix doesn't have to support directory paths as a prefix. In my case I could just as easily provide the sub-directories as part of the file name (rsa_intermediate_, rsa_modern_, etc).

Which version are you referring to

  • OS: Ubuntu 20.10 (Docker Host, Vultr VPS)
  • Platform: Linux 5.8.0-38-generic x86_64
  • Version: testssl.sh 3.1dev from https://testssl.sh/dev/ (Image ID: fe90513119fb, 8 days ago, digest: sha256:fca6197abd505668a1f5d6557c9652cd83edabe98f97a672c837cb9f9b1ca376)
  • OpenSSL: /home/testssl/bin/openssl.Linux.x86_64 ("OpenSSL 1.0.2-chacha (1.0.2k-dev)" [~183 ciphers] from Jan 18 17:12:17 2019?)

Feature request is for running without docker image due to docker network performance overhead however (halves the time to run).

Describe alternatives you've considered Current workarounds are via volume mounting with docker image to the desired output location (requires docker), or having additional commands in test scripts to change directory(mkdir -p <path> && cd <path> followed by cd back to test root directory).

polarathene avatar Feb 18 '21 01:02 polarathene

I might be a bit slow at the end of the day.

Could you help out with a specific example for a --file?

drwetter avatar Feb 24 '21 18:02 drwetter

Could you help out with a specific example for a --file?

Sure! Here's the test that runs it, there's two TODO comments in the file related to testssl.sh issues, one being this.

docker run --rm \
        --user "$(id -u):$(id -g)" \
        --network "${NETWORK}" \
        --volume "${TLS_CONFIG_VOLUME}" \
        --volume "${TLS_RESULTS_DIR}/${RESULTS_PATH}/:/output" \
        --workdir "/output" \
        drwetter/testssl.sh:3.1dev --quiet --file "/config/ssl/testssl.txt" --mode parallel --overwrite --preference

Here's the testssl.txt file it references:

# Provides commands for `testssl.sh` `--file` option to run multiple tests with
--jsonfile-pretty port_25.json --starttls smtp example.test:25
--jsonfile-pretty port_587.json --starttls smtp example.test:587
--jsonfile-pretty port_465.json example.test:465

--jsonfile-pretty port_110.json --starttls pop3 example.test:110
--jsonfile-pretty port_995.json example.test:995

--jsonfile-pretty port_143.json --starttls imap example.test:143
--jsonfile-pretty port_993.json example.test:993

polarathene avatar Feb 24 '21 19:02 polarathene