mirror of
https://github.com/appleboy/ssh-action.git
synced 2024-11-23 06:16:10 +08:00
ci: add GitHub Actions job for SSH key passphrase support
- Add a new job `support-key-passphrase` 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 a step to the new job for running an SSH command with a passphrase - Add a new private SSH key file `id_passphrase` to the test data - Add a new public SSH key file `id_passphrase.pub` to the test data Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
f05aefe351
commit
e40b597081
55
.github/workflows/ssh-server.yml
vendored
55
.github/workflows/ssh-server.yml
vendored
@ -126,3 +126,58 @@ jobs:
|
|||||||
script: |
|
script: |
|
||||||
mkdir abc/def
|
mkdir abc/def
|
||||||
ls -al
|
ls -al
|
||||||
|
|
||||||
|
support-key-passphrase:
|
||||||
|
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_passphrase.pub >> $GITHUB_ENV
|
||||||
|
echo "EOF" >> $GITHUB_ENV
|
||||||
|
echo "======= public key ========="
|
||||||
|
cat testdata/.ssh/id_passphrase.pub
|
||||||
|
echo "============================"
|
||||||
|
echo "PRIVATE_KEY<<EOF" >> $GITHUB_ENV
|
||||||
|
cat testdata/.ssh/id_passphrase >> $GITHUB_ENV
|
||||||
|
echo "EOF" >> $GITHUB_ENV
|
||||||
|
echo "======= private key ========="
|
||||||
|
cat testdata/.ssh/id_passphrase
|
||||||
|
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: ssh key passphrase
|
||||||
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
|
with:
|
||||||
|
host: ${{ env.REMOTE_HOST }}
|
||||||
|
username: linuxserver.io
|
||||||
|
key: ${{ env.PRIVATE_KEY }}
|
||||||
|
port: 2222
|
||||||
|
passphrase: 1234
|
||||||
|
script: |
|
||||||
|
whoami
|
||||||
|
ls -al
|
||||||
|
39
testdata/.ssh/id_passphrase
vendored
Normal file
39
testdata/.ssh/id_passphrase
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||||
|
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABA5p9eRXu
|
||||||
|
BJantF5ARnBfnqAAAAEAAAAAEAAAGXAAAAB3NzaC1yc2EAAAADAQABAAABgQCuWKQh09Vl
|
||||||
|
v3IRu/+oK18ws72VQS7PCXJaIEp1L+7HqC/6+plizaVgd9SjAg0UJSqvp+WfpU5I53hevE
|
||||||
|
0Ip3s71Tsoeu1azWoi2Mbq3ycZ5ysh4htZZklKBkYsyW+2EdITPcmhA8rF+KiDRyuvk7fD
|
||||||
|
o08G3YWgbCScY6VkLA06ReThCehAY54WNvgbx7lyvCWj1qYG0XjM7mTQHr3QN0JHJ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V9qyhpURYM
|
||||||
|
1EdZB86uZWJOaRA8/fpwt8z2stmpKpuGFQOSgr7W5JQWSFeTAMYPoafsm0PD1zSyw7j1wE
|
||||||
|
DWlmUAzpMirSnPUQndR8IcF7fZmI8J1g30eIFTQpoTDCyoiegkOXHa9HyWwmEAwws1PCWZ
|
||||||
|
a5Viw6XLJI3tahSNhZzdY/UNFikuO8AuIDXykBM7riaqK4PADtmGY88QGWXQbw5xxWtH6r
|
||||||
|
Wwk4KzDL9UFeCMSiQo//e+kg/mPLml6Sa4THOzP3iOmx810JoMDmF/jvtpC+ew5HpPPtg4
|
||||||
|
h55pSap77CEhEhE5FPZKuH9f7/E=
|
||||||
|
-----END OPENSSH PRIVATE KEY-----
|
1
testdata/.ssh/id_passphrase.pub
vendored
Normal file
1
testdata/.ssh/id_passphrase.pub
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCuWKQh09Vlv3IRu/+oK18ws72VQS7PCXJaIEp1L+7HqC/6+plizaVgd9SjAg0UJSqvp+WfpU5I53hevE0Ip3s71Tsoeu1azWoi2Mbq3ycZ5ysh4htZZklKBkYsyW+2EdITPcmhA8rF+KiDRyuvk7fDo08G3YWgbCScY6VkLA06ReThCehAY54WNvgbx7lyvCWj1qYG0XjM7mTQHr3QN0JHJNdFaG3MCi1rTG2hK/owOlzcesIbzfM1VMIQG5HT4vNg/ULP0BTZ7pGtdvWlvR/660KQwc1tBxLqxI1dYoCgiS/gMyPxhOtNKTvhR/NR7e2sp/StkXURIxTHhj0KjKbnpXTQ2IndnesHAG9kDJ7c31SXastWpbXWhCIdRZk+KQsnmwobZlw3w1vfx2Dm7M2ZCcCgG/ArUPjY44nGOWO5Nz98QHyz3IocsKJXrGVo/3YpNNu72jkw7UGVMqh1dAe3ZMaCAC5pAAa0HKvkid7jdXawL2b//+vsAPSHdnEjP58= mtk10671@NB22040567
|
Loading…
Reference in New Issue
Block a user