test: fix netcat install and listen for socket audit device (#23134)

Fix an issue where netcat would not be installed correctly with certain
package managers. We also fix an issue where SSH cannot exit because nc
is waitaing for SIGHUP, resulting in scenarios running forever.

Signed-off-by: Ryan Cragun <me@ryan.ec>
This commit is contained in:
Ryan Cragun 2023-09-15 18:33:47 -06:00 committed by GitHub
parent 79b2f09715
commit 464aeebddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 8 deletions

View File

@ -1,14 +1,10 @@
#!/bin/env sh
#!/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
set -eux
LOG_DIR="$(dirname "$LOG_FILE_PATH")"
# Run nc to listen to port 9090
nc -l 9090 &
# Run nc to listen to port 9090 for the socket audit log
nohup nc -l 9090 &>/dev/null </dev/null &
$VAULT_BIN_PATH audit enable file file_path="$LOG_FILE_PATH"
$VAULT_BIN_PATH audit enable syslog tag="vault" facility="AUTH"

View File

@ -41,7 +41,7 @@ if [ -f /etc/debian_version ]; then
cd /tmp
retry 5 sudo apt update
retry 5 sudo apt install -y "$${packages[@]}"
retry 5 sudo apt install -y $${packages[@]}
else
cd /tmp
retry 7 sudo yum -y install $${packages[@]}