Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can decrypt secure env variables in Travis CI?

Tags:

I have .travis.yml with some secure (encrypted) env variables. Now I need to descrypt those variables to use them in different project.

Is there easy way of doing this (except triggering a commit and printing them in console output)?

like image 966
user606521 Avatar asked Jul 20 '15 14:07

user606521


People also ask

Which of following option is used to automatically decrypt the command in Travis CI?

The travis encrypt-file command will encrypt a file for you using a symmetric encryption (AES-256), and it will store the secret in a secure variable. It will output the command you can use in your build script to decrypt the file. Make sure to add super_secret.

Which of the following encryption scheme is used by Travis CI?

Encryption scheme # Travis CI uses asymmetric cryptography. For each registered repository, Travis CI generates an RSA keypair. Travis CI keeps the private key private, but makes the repository's public key available to those who have access to the repository.

What is ${ Travis_branch?

TRAVIS_BRANCH : for push builds, or builds not triggered by a pull request, this is the name of the branch. for builds triggered by a pull request this is the name of the branch targeted by the pull request. for builds triggered by a tag, this is the same as the name of the tag ( TRAVIS_TAG ).


2 Answers

You can't decrypt locally from what I understand but you can recover the key/values. By nature, they have to be decrypted to be used during the build process.

  1. Go to your last build of your current project.
  2. Select "Debug Build"
  3. SSH into the instance using the provided user and host ***********@to2.tmate.io
  4. Once in the remote shell, run env.

This will print all of the environment variables so you will have to dig a little for your secure ones but they will be there.

like image 106
Daniel Smith Avatar answered Oct 19 '22 10:10

Daniel Smith


I don't think you can decrypt it. Public key is used to encrypt the data and it can only be decrypted with the private key which travis doesn't provide.

like image 31
evgeny.myasishchev Avatar answered Oct 19 '22 10:10

evgeny.myasishchev