Skip to content

Commit 708039d

Browse files
committed
Updated SSH volume mount process to have less permissions
1 parent c8ab954 commit 708039d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/functions.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,10 +946,15 @@ run_ansible() {
946946
# Create the collections directory if it doesn't exist
947947
mkdir -p "$ansible_collections_path"
948948

949+
# Create the known_hosts file if it doesn't exist
950+
if [[ ! -f "$HOME/.ssh/known_hosts" ]]; then
951+
touch "$HOME/.ssh/known_hosts"
952+
fi
953+
949954
while [[ "$#" -gt 0 ]]; do
950955
case "$1" in
951956
--allow-ssh)
952-
additional_docker_args+=("-v" "$HOME/.ssh/:/ssh/" "-v" "$ansible_collections_path:/etc/ansible/collections")
957+
additional_docker_args+=("-v" "$HOME/.ssh/:/ssh/:ro" "-v" "$HOME/.ssh/known_hosts:/ssh/known_hosts:rw" "-v" "$ansible_collections_path:/etc/ansible/collections")
953958
# Mount the SSH Agent for macOS and Linux (including WSL2) systems
954959
if [ -n "$SSH_AUTH_SOCK" ]; then
955960
case "$(uname -s)" in

0 commit comments

Comments
 (0)