From 222545746befdd85694b1deec335f7a7b59d62a9 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 7 Jan 2024 17:13:16 +0800 Subject: [PATCH] chore: refactor build and deployment processes - Add `sudo` to the apk add command in the lint workflow - Add SSH server setup to the Makefile Signed-off-by: Bo-Yi Wu --- .github/workflows/lint.yml | 2 +- Makefile | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 30823fe..51605ec 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -34,7 +34,7 @@ jobs: - name: setup sshd server run: | - apk add git make curl perl bash build-base zlib-dev ucl-dev + apk add git make curl perl bash build-base zlib-dev ucl-dev sudo make ssh-server - name: testing diff --git a/Makefile b/Makefile index ce632e1..d8878db 100644 --- a/Makefile +++ b/Makefile @@ -104,6 +104,15 @@ ssh-server: cat tests/.ssh/test.pub >> /home/drone-scp/.ssh/authorized_keys chmod 600 /home/drone-scp/.ssh/authorized_keys chown -R drone-scp /home/drone-scp/.ssh + # add public key to root user + mkdir -p /root/.ssh + chmod 700 /root/.ssh + cat tests/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys + cat tests/.ssh/test.pub >> /root/.ssh/authorized_keys + chmod 600 /root/.ssh/authorized_keys + # Append the following entry to run ALL command without a password for a user named drone-scp: + cat tests/sudoers >> /etc/sudoers.d/sudoers + # install ssh and start server apk add --update openssh openrc rm -rf /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_dsa_key sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication yes/g' /etc/ssh/sshd_config