Giter VIP home page Giter VIP logo

steps-activate-ssh-key's Introduction

Activate SSH key (RSA private key)

Step changelog

Add your SSH key to the build machine to access private repositories

Description

This Step makes sure Bitrise has access to your repository when cloning SSH URLs. The Step saves the provided private key of your SSH keypair to a file and then loads it into the SSH agent.

Configuring the Step

By default, you do not have to change anything about the Step's configuration.

The step downloads the SSH key defined in your App Settings, so most of the time it's the only thing you need to configure (more info.

All you need to do is make sure that you registered your key pair on Bitrise and the public key at your Git provider. You can generate and register an SSH keypair in two ways.

  • Automatically during the app creation process.
  • Manually during the app creation process or at any other time. You generate your own SSH keys and register them on Bitrise and at your Git provider. The SSH key should not have a passphrase!

Note: if you configure to use HTTPS instead of SSH git access, you don't need to use this Step.

Troubleshooting

If the Step fails, check the public key registered to your Git repository and compare it to the public key registered on Bitrise. The most frequent issue is that someone deleted or revoked the key on your Git provider's website.

You can also set the Enable verbose logging input to true. This provides additional information in the log.

Useful links

Related Steps

๐Ÿงฉ Get started

Add this step directly to your workflow in the Bitrise Workflow Editor.

You can also run this step directly with Bitrise CLI.

โš™๏ธ Configuration

Inputs
Key Description Flags Default
ssh_rsa_private_key The private key of the SSH keypair in RSA format. sensitive $SSH_RSA_PRIVATE_KEY
ssh_key_save_path Path where the private key should be saved $HOME/.ssh/bitrise_step_activate_ssh_key
is_remove_other_identities When the step detects a running SSH agent and this input is true, it removes all loaded identities and restarts the agent before loading the configured key. When there is no running SSH agent, this input has no effect. Note: this only affects the in-memory SSH agent data, keys on disk are not touched. Options: * "true" * "false" true
verbose Enable verbose log option for better debug required false
Outputs
Environment Variable Description
SSH_AUTH_SOCK If the is_should_start_new_agent option is enabled, and no accessible ssh-agent is found, the step will start a new ssh-agent. This output contains the path of the socket created by ssh-agent, which can be used to access the started ssh-agent (learn more)

๐Ÿ™‹ Contributing

We welcome pull requests and issues against this repository.

For pull requests, work on your changes in a forked repository and use the Bitrise CLI to run step tests locally.

Note: this step's end-to-end tests (defined in e2e/bitrise.yml) are working with secrets which are intentionally not stored in this repo. External contributors won't be able to run those tests. Don't worry, if you open a PR with your contribution, we will help with running tests and make sure that they pass.

Learn more about developing steps:

steps-activate-ssh-key's People

Contributors

banyikanna avatar bazscsa avatar birmacherakos avatar bitrise-coresteps-bot avatar godrei avatar lpusok avatar ofalvai avatar renovate[bot] avatar trapacska avatar viktorbenei avatar zoltan-baba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

steps-activate-ssh-key's Issues

No such file or directory

Hi. Need help:

id: activate-ssh-key |
| version: 4.0.3 |
| collection: https://github.com/bitrise-io/bitrise-steplib.git |
| toolkit: go

INFO[06:44:53] Start installing (expect) with apt-get
INFO[06:44:53] * [OK] Step dependency (expect) installed, available.
INFO[06:44:53] Start installing (git) with apt-get
INFO[06:44:53] * [OK] Step dependency (git) installed, available.
ERRO[06:45:00] [ENVMAN] - Failed to execute command:fork/exec TopDoc/.bitrise/toolkits/go/cache/https___github.com_bitrise-io_bitrise-steplib.git-activate-ssh-key-: no such file or directory

activate-ssh-key (exit code: 1)

Add support for newer OpenSSH private keys format

Hi. Since OpenSSH version 7.8, private keys are created by default using the newer OpenSSH private key format (first released with OpenSSH version 6.5 on 2014) instead of the older OpenSSL's PEM format.

The new format has increased resistance to brute-force password cracking. Additionally Ed25519 keys always use the new private key format.

Currently with the latest version 4.0.5 of this step, this is the error output when using the OpenSSH private key format:

+------------------------------------------------------------------------------+
| (0) SSH Match certifiactes key                                               |
+------------------------------------------------------------------------------+
| id: activate-ssh-key                                                         |
| version: 4.0.5                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: go                                                                  |
| time: 2020-10-09T15:22:50Z                                                   |
+------------------------------------------------------------------------------+
|                                                                              |
Config:
- SSHRsaPrivateKey: *****
- SSHKeySavePath: /Users/vagrant/.ssh/match_certificates_repo.key
- IsRemoveOtherIdentities: true
- Verbose: false
$ ssh-add "-l"
ssh_agent_check_result: 0
running / accessible ssh-agent detected
$ ssh-add "-D"
All identities removed.
$ ssh-agent "-k"
SSH_AGENT_PID not set, cannot kill agent
Exit code: exit status 1
$ bash "-c" "/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/spawn510245218/tmp_spawn.sh"
spawn ssh-add /Users/vagrant/.ssh/match_certificates_repo.key
Error loading key "/Users/vagrant/.ssh/match_certificates_repo.key": invalid format
send: spawn id exp5 not open
    while executing
"send "nopass\n""
Exit code: 1
Error, Failed to add the SSH key to ssh-agent with an empty passphrase
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | SSH Match certifiactes key (exit code: 1)                     | 3.08 sec |
+---+---------------------------------------------------------------+----------+
| Issue tracker: https://github.com/bitrise-io/steps-activate-ssh-key/issues   |
| Source: https://github.com/bitrise-io/steps-activate-ssh-key                 |
+---+---------------------------------------------------------------+----------+

On the VM running macOS 10.15 (osx-xcode-11.7.x stack) the OpenSSH version is:

vagrant@prd-veg-std-p-xcode-11-7-201009151107-nwUFbTbkjfzcYLQgq9XYGi ~ % ssh -V
OpenSSH_8.1p1, LibreSSL 2.7.3

As a temporal workaround PEM formatted keys need to be used.

Sign

Troubleshooting

  • I've searched discuss.bitrise.io for possible solutions.
  • Which version of the step is effected? 1.2.3
  • Is the issue reproducible with the latest version? YES / NO
  • Does the issue happen sporadically, or every time? SPORADIC / EVERY TIME
  • Is the issue reproducible locally by following our local debug guide? YES / NO / NOT APPLICABLE

Useful information

Issue description

Bitrise info

  • Build URL: Please share the build URL with us.
  • Bitrise Support enabled: YES / NO
  • Log:

Steps to reproduce

  1. ...
  2. ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.