diff --git a/README.md b/README.md index b473bdb..d13dc55 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,16 @@ See [action.yml](./action.yml) for more detailed information. * envs - pass environment variable to shell script * debug - enable debug mode +SSH Proxy Setting: + +* proxy_host - proxy host +* proxy_port - proxy port, default is `22` +* proxy_username - proxy username +* proxy_password - proxy password +* proxy_timeout - timeout for ssh to proxy host, default is `30s` +* proxy_key - content of ssh proxy private key. +* proxy_key_path - path of ssh proxy private key + ### Example Executing remote ssh commands using password. @@ -165,3 +175,46 @@ ls -al err: mkdir: cannot create directory ‘abc/def’: No such file or directory ##[error]Docker run failed with exit code 1 ``` + +How to connect remote server using `ProxyCommand`? + +```bash ++--------+ +----------+ +-----------+ +| Laptop | <--> | Jumphost | <--> | FooServer | ++--------+ +----------+ +-----------+ +``` + +in your `~/.ssh/config`, you will see the following. + +```bash +Host Jumphost + HostName Jumphost + User ubuntu + Port 22 + IdentityFile ~/.ssh/keys/jump_host.pem + +Host FooServer + HostName FooServer + User ubuntu + Port 22 + ProxyCommand ssh -q -W %h:%p Jumphost +``` + +How to convert to YAML format of GitHubActions. + +```diff + - name: ssh proxy command + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} ++ proxy_host: ${{ secrets.PROXY_HOST }} ++ proxy_username: ${{ secrets.PROXY_USERNAME }} ++ proxy_key: ${{ secrets.PROXY_KEY }} ++ proxy_port: ${{ secrets.PROXY_PORT }} + script: | + mkdir abc/def + ls -al +``` diff --git a/action.yml b/action.yml index 2f90928..1e73525 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,22 @@ inputs: description: 'content of ssh private key. ex raw content of ~/.ssh/id_rsa' key_path: description: 'path of ssh private key' + proxy_host: + description: 'ssh proxy remote host' + proxy_port: + description: 'ssh proxy remote port' + default: 22 + proxy_username: + description: 'ssh proxy username' + proxy_password: + description: 'ssh proxy password' + proxy_timeout: + description: 'timeout for ssh to proxy host' + default: "30s" + proxy_key: + description: 'content of ssh proxy private key. ex raw content of ~/.ssh/id_rsa' + proxy_key_path: + description: 'path of ssh proxy private key' script: description: 'execute commands' script_stop: