Skip to content

Instantly share code, notes, and snippets.

@Brantone
Last active March 6, 2017 22:55
Show Gist options
  • Save Brantone/c43cc5922cd1626c162a71e6c07c84fb to your computer and use it in GitHub Desktop.
Save Brantone/c43cc5922cd1626c162a71e6c07c84fb to your computer and use it in GitHub Desktop.
Chef Random tips
Commands
--------
Run on nodes
# knife ssh "name:macOS2*" "sudo DEVELOPER_DIR=/Library/Developer/CommandLineTools/ chef-client" -x [user] -P
Data Bags
---------
If not already have secret key:
$ openssl rand -base64 512 | tr -d '\r\n' > secret_key
Encrypt:
$ openssl base64 -in input.p12 -out output.p12
Convert (really needed?):
$ sed s/$/\\\\n/ [$FILE] | tr -d '\n'
Copy output into JSON with "id" and other stuff.
Create data bag
$ knife data bag from file [DATA_BAG_NAME] [JSON_FILE] --secret-file ~/.chef/encrypted_data_bag_secret
Decrypted file with base64:
$ knife data bag show osx_signing osx_signing
Copy "p12s" section to temp.p12
$ openssl base64 -d -in temp.p12 -out files.p12
Android Keystore Data Bag
-------------------------
1. Generate keystore via Android Studio.
2. openssl base64
3. Run sed
4. Create JSON file
5. knife data bag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment