Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of test(e2e): Update openssh module to account for image changes into release/0.18.x #5297

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

cp /ca/ca-key.pub /etc/ssh/ca-key.pub
chown 1000:1000 /etc/ssh/ca-key.pub
chmod 644 /etc/ssh/ca-key.pub
echo TrustedUserCAKeys /etc/ssh/ca-key.pub >> /etc/ssh/sshd_config
echo PermitTTY yes >> /etc/ssh/sshd_config
sed -i 's/X11Forwarding no/X11Forwarding yes/' /etc/ssh/sshd_config
echo "X11UseLocalhost no" >> /etc/ssh/sshd_config
cp /ca/ca-key.pub /config/sshd/ca-key.pub
chown 1000:1000 /config/sshd/ca-key.pub
chmod 644 /config/sshd/ca-key.pub
echo TrustedUserCAKeys /config/sshd/ca-key.pub >> /config/sshd/sshd_config
echo PermitTTY yes >> /config/sshd/sshd_config
sed -i 's/X11Forwarding no/X11Forwarding yes/' /config/sshd/sshd_config
echo "X11UseLocalhost no" >> /config/sshd/sshd_config

apk update
apk add xterm util-linux dbus ttf-freefont xauth firefox
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

sed -i 's/AllowTcpForwarding no/AllowTcpForwarding yes/' /config/sshd/sshd_config
10 changes: 8 additions & 2 deletions enos/modules/docker_openssh_server_ca_key/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,14 @@ locals {
ca_public_key = data.tls_public_key.ca_key.public_key_openssh
}

data "docker_registry_image" "openssh" {
name = var.image_name
}

resource "docker_image" "openssh_server" {
name = var.image_name
keep_locally = true
name = var.image_name
keep_locally = true
pull_triggers = [data.docker_registry_image.openssh.sha256_digest]
}

resource "docker_container" "openssh_server" {
Expand All @@ -75,6 +80,7 @@ resource "docker_container" "openssh_server" {
"TZ=US/Eastern",
"USER_NAME=${var.target_user}",
"PUBLIC_KEY=${local.ssh_public_key}",
"SUDO_ACCESS=true",
]
network_mode = "bridge"
dynamic "networks_advanced" {
Expand Down
Loading