1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 05:40:11 +01:00
gocsaf/docs/scripts/uploadToProvider.sh
Bernhard Reiter 3da37a533b
Improve integration test uploadToProvider.sh
* Remove `let` from the script as it will return 1 (signalling an error) on the
   first iteration, which will stop the script when in `set -e` mode.
   It also is unnecessary, as the increment can be done at the place of
   usage directly.
 * Added a "remainder aka modulo" division, otherwise there will be no
   TLP option set, once we run out of the four entries in the TLSs
   list.
 * (Style) remove superfluous semicolons.
2022-04-13 17:46:10 +02:00

29 lines
1 KiB
Bash
Executable file

#!/usr/bin/env bash
#
# Desc: Call ./downloadExamples.sh and then try csaf_uploader.
#
# This file is Free Software under the MIT License
# without warranty, see README.md and LICENSES/MIT.txt for details.
#
# SPDX-License-Identifier: MIT
#
# SPDX-FileCopyrightText: 2022 German Federal Office for Information Security (BSI) <https://www.bsi.bund.de>
# Software-Engineering: 2022 Intevation GmbH <https://intevation.de>
set -e
# assumes that the following script only downloads file with filenames
# following https://docs.oasis-open.org/csaf/csaf/v2.0/cs01/csaf-v2.0-cs01.html#51-filename
# which are save to process further
./downloadExamples.sh
TLPs=("white" "green" "amber" "red")
COUNTER=0
for f in $(ls csaf_examples); do
../../bin-linux-amd64/csaf_uploader --insecure -P security123 -a upload \
-t ${TLPs[$((COUNTER++ % 4))]} \
-u https://localhost:8443/cgi-bin/csaf_provider.go \
--client-cert ~/devca1/testclient1.crt \
--client-key ~/devca1/testclient1-key.pem \
./csaf_examples/"$f"
done