-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
46 lines (37 loc) · 1.49 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Copyright (c) 2022 OpenFaaS Ltd
name: 'Install SSHD for actor'
description: 'Install SSHD for actor'
branding:
icon: 'arrow-right-circle'
color: 'gray-dark'
runs:
using: 'composite'
steps:
- name: Install SSHD
shell: bash
id: download
run: |
echo Installing/re-configuring sshd and tmux
sudo systemctl status|grep ssh
sudo apt update -qqqy && \
sudo apt install -qqqy openssh-server tmux && \
sudo systemctl enable ssh
if [ -z "$(find /etc/ssh/ -name "ssh_host_*"|xargs echo -n)" ]; then DEBIAN_FRONTEND=noninteractive sudo -E dpkg-reconfigure openssh-server ; fi
- name: Disable password auth
shell: bash
id: disablepwd
run: |
echo "PasswordAuthentication no" | sudo tee -a /etc/ssh/sshd_config
echo "ChallengeResponseAuthentication no" | sudo tee -a /etc/ssh/sshd_config
sudo sed -i "s/.*PasswordAuthentication.*/PasswordAuthentication no/g" /etc/ssh/sshd_config
sudo systemctl daemon-reload
sudo systemctl status|grep ssh
sudo systemctl restart ssh --now
- name: Install actor's keys
shell: bash
id: keys
run: |
mkdir -p ~/.ssh
curl -s "https://api.github.com/users/$GITHUB_ACTOR/keys" | jq -r '.[].key' > ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys