Skip to content

Commit fc1c1fc

Browse files
committed
ci: add GitHub Actions job for ed25519 key support
- Add a new job `support-ed25519-key` to the GitHub Actions workflow - Add steps to the new job for checking out code, adding public and private keys to the environment, and creating a new SSH server - Add steps to the new job for testing the `id_ed25519` key using `appleboy/ssh-action` - Add a new private SSH key file `testdata/.ssh/id_ed25519` - Add a new public SSH key file `testdata/.ssh/id_ed25519.pub` Signed-off-by: appleboy <[email protected]>
1 parent aa293c2 commit fc1c1fc

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

.github/workflows/ssh-server.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,3 +283,57 @@ jobs:
283283
script_stop: true
284284
script: |
285285
whoami
286+
287+
support-ed25519-key:
288+
runs-on: ubuntu-latest
289+
steps:
290+
- name: Checkout code
291+
uses: actions/checkout@v4
292+
293+
- name: add public key to env
294+
run: |
295+
echo "PUBLIC_KEY<<EOF" >> $GITHUB_ENV
296+
cat testdata/.ssh/id_ed25519.pub >> $GITHUB_ENV
297+
echo "EOF" >> $GITHUB_ENV
298+
echo "======= public key ========="
299+
cat testdata/.ssh/id_ed25519.pub
300+
echo "============================"
301+
echo "PRIVATE_KEY<<EOF" >> $GITHUB_ENV
302+
cat testdata/.ssh/id_ed25519 >> $GITHUB_ENV
303+
echo "EOF" >> $GITHUB_ENV
304+
echo "======= private key ========="
305+
cat testdata/.ssh/id_ed25519
306+
echo "============================"
307+
308+
- name: create new ssh server
309+
run: |
310+
docker run -d \
311+
--name=openssh-server \
312+
--hostname=openssh-server \
313+
-p 2222:2222 \
314+
-e PUBLIC_KEY="${{ env.PUBLIC_KEY }}" \
315+
-e SUDO_ACCESS=false \
316+
-e PASSWORD_ACCESS=true \
317+
-e USER_PASSWORD=password \
318+
-e USER_NAME=linuxserver.io \
319+
--restart unless-stopped \
320+
lscr.io/linuxserver/openssh-server:latest
321+
docker exec openssh-server sh -c "hostname -i" > ip.txt
322+
echo "REMOTE_HOST<<EOF" >> $GITHUB_ENV
323+
cat ip.txt >> $GITHUB_ENV
324+
echo "EOF" >> $GITHUB_ENV
325+
echo "======= container ip address ========="
326+
cat ip.txt
327+
echo "======================================"
328+
sleep 2
329+
330+
- name: testing id_ed25519 key
331+
uses: appleboy/[email protected]
332+
with:
333+
host: ${{ env.REMOTE_HOST }}
334+
username: linuxserver.io
335+
key: ${{ env.PRIVATE_KEY }}
336+
port: 2222
337+
script: |
338+
whoami
339+
ls -al

testdata/.ssh/id_ed25519

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-----BEGIN OPENSSH PRIVATE KEY-----
2+
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
3+
QyNTUxOQAAACDoi7FltQCqpWporKh61nJUPIeazUYdzdstncoeU5XS2AAAAKBF5e2SReXt
4+
kgAAAAtzc2gtZWQyNTUxOQAAACDoi7FltQCqpWporKh61nJUPIeazUYdzdstncoeU5XS2A
5+
AAAEBrsLG1vSg08yaQgYM46KQW93Lz2ZikS1tTMH35gfHhpOiLsWW1AKqlamisqHrWclQ8
6+
h5rNRh3N2y2dyh5TldLYAAAAFnlvdXJfZW1haWxAZXhhbXBsZS5jb20BAgMEBQYH
7+
-----END OPENSSH PRIVATE KEY-----

testdata/.ssh/id_ed25519.pub

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOiLsWW1AKqlamisqHrWclQ8h5rNRh3N2y2dyh5TldLY [email protected]

0 commit comments

Comments
 (0)