istio.io/tests/security/plugin_ca_cert/scripts/plugin_ca_cert.txt

45 lines
1.4 KiB
Bash

#!/usr/bin/env bash
# Copyright Istio Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
set -u
set -o pipefail
source ${REPO_ROOT}/content/en/docs/tasks/security/plugin-ca-cert/snips.sh
# Disable errors, since the next command is expected to return an error.
set +e
set +o pipefail
# Retrieve the certificate chain
snip_verifying_the_certificates_1
# Restore error handling
set -e
set -o pipefail
# Split the certificate chain to cert files
snip_verifying_the_certificates_2
out=$(snip_verifying_the_certificates_3 2>&1)
_verify_same "$out" "$snip_verifying_the_certificates_3_out" "snip_verifying_the_certificates_3"
out=$(snip_verifying_the_certificates_4 2>&1)
_verify_same "$out" "$snip_verifying_the_certificates_4_out" "snip_verifying_the_certificates_4"
out=$(snip_verifying_the_certificates_5 2>&1)
_verify_same "$out" "$snip_verifying_the_certificates_5_out" "snip_verifying_the_certificates_5"