mirror of
https://gitea.com/actions/appleboy-ssh-action.git
synced 2024-11-22 01:59:35 +01:00
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 <appleboy.tw@gmail.com>
This commit is contained in:
parent
aa293c24bb
commit
fc1c1fce51
3 changed files with 62 additions and 0 deletions
54
.github/workflows/ssh-server.yml
vendored
54
.github/workflows/ssh-server.yml
vendored
|
@ -283,3 +283,57 @@ jobs:
|
||||||
script_stop: true
|
script_stop: true
|
||||||
script: |
|
script: |
|
||||||
whoami
|
whoami
|
||||||
|
|
||||||
|
support-ed25519-key:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: add public key to env
|
||||||
|
run: |
|
||||||
|
echo "PUBLIC_KEY<<EOF" >> $GITHUB_ENV
|
||||||
|
cat testdata/.ssh/id_ed25519.pub >> $GITHUB_ENV
|
||||||
|
echo "EOF" >> $GITHUB_ENV
|
||||||
|
echo "======= public key ========="
|
||||||
|
cat testdata/.ssh/id_ed25519.pub
|
||||||
|
echo "============================"
|
||||||
|
echo "PRIVATE_KEY<<EOF" >> $GITHUB_ENV
|
||||||
|
cat testdata/.ssh/id_ed25519 >> $GITHUB_ENV
|
||||||
|
echo "EOF" >> $GITHUB_ENV
|
||||||
|
echo "======= private key ========="
|
||||||
|
cat testdata/.ssh/id_ed25519
|
||||||
|
echo "============================"
|
||||||
|
|
||||||
|
- name: create new ssh server
|
||||||
|
run: |
|
||||||
|
docker run -d \
|
||||||
|
--name=openssh-server \
|
||||||
|
--hostname=openssh-server \
|
||||||
|
-p 2222:2222 \
|
||||||
|
-e PUBLIC_KEY="${{ env.PUBLIC_KEY }}" \
|
||||||
|
-e SUDO_ACCESS=false \
|
||||||
|
-e PASSWORD_ACCESS=true \
|
||||||
|
-e USER_PASSWORD=password \
|
||||||
|
-e USER_NAME=linuxserver.io \
|
||||||
|
--restart unless-stopped \
|
||||||
|
lscr.io/linuxserver/openssh-server:latest
|
||||||
|
docker exec openssh-server sh -c "hostname -i" > ip.txt
|
||||||
|
echo "REMOTE_HOST<<EOF" >> $GITHUB_ENV
|
||||||
|
cat ip.txt >> $GITHUB_ENV
|
||||||
|
echo "EOF" >> $GITHUB_ENV
|
||||||
|
echo "======= container ip address ========="
|
||||||
|
cat ip.txt
|
||||||
|
echo "======================================"
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
- name: testing id_ed25519 key
|
||||||
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
|
with:
|
||||||
|
host: ${{ env.REMOTE_HOST }}
|
||||||
|
username: linuxserver.io
|
||||||
|
key: ${{ env.PRIVATE_KEY }}
|
||||||
|
port: 2222
|
||||||
|
script: |
|
||||||
|
whoami
|
||||||
|
ls -al
|
||||||
|
|
7
testdata/.ssh/id_ed25519
vendored
Normal file
7
testdata/.ssh/id_ed25519
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||||
|
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
|
||||||
|
QyNTUxOQAAACDoi7FltQCqpWporKh61nJUPIeazUYdzdstncoeU5XS2AAAAKBF5e2SReXt
|
||||||
|
kgAAAAtzc2gtZWQyNTUxOQAAACDoi7FltQCqpWporKh61nJUPIeazUYdzdstncoeU5XS2A
|
||||||
|
AAAEBrsLG1vSg08yaQgYM46KQW93Lz2ZikS1tTMH35gfHhpOiLsWW1AKqlamisqHrWclQ8
|
||||||
|
h5rNRh3N2y2dyh5TldLYAAAAFnlvdXJfZW1haWxAZXhhbXBsZS5jb20BAgMEBQYH
|
||||||
|
-----END OPENSSH PRIVATE KEY-----
|
1
testdata/.ssh/id_ed25519.pub
vendored
Normal file
1
testdata/.ssh/id_ed25519.pub
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOiLsWW1AKqlamisqHrWclQ8h5rNRh3N2y2dyh5TldLY your_email@example.com
|
Loading…
Reference in a new issue