Skip to content

Instantly share code, notes, and snippets.

# Ensure what variable is available
$ conjur env run --yaml '{CONJUR_GROUP: !var variable/name}' -- 'echo "$CONJUR_GROUP"'

# Install conjur's python api module first
$ sudo pip install conjur

# Okay, run ansible to affect localhost
# -K mean ask for sudo password
# (so you can be happy run this command by cron on a remote host. but better fill your own inventory file and run the play across multiple remote hosts at once)
@asakura
asakura / app.js
Last active August 29, 2015 14:10
var assert = require('assert'),
conjur = require('conjur-api'),
netrc = require('netrc'),
url = require('url'),
yaml = require('js-yaml'),
fs = require('fs');
function main(baseUrl, account, login, password) {
var infoUrl = baseUrl + 'api/info',
authnUrl = baseUrl + 'api/authn',
@asakura
asakura / session
Last active August 29, 2015 14:10
Seed example for cloud-init version > 0.7
$ mkdir seed
$ cd seed
# create user-data and meta-data files that will be used to modify image on first boot
# feel free to change `instance-id' and `local-hostname'
$ { echo instance-id: iid-local01; echo local-hostname: cloudimg; } > meta-data
# customize that with your user info
$ cat << EOF > user-data
#cloud-config
@asakura
asakura / gist:05702aad03e757316741
Last active August 29, 2015 14:10
Seed example for cloud-init version < 0.7
$ mkdir seed
$ cd seed
# create user-data and meta-data files that will be used to modify image on first boot
# feel free to change `instance-id' and `local-hostname'
$ { echo instance-id: iid-local01; echo local-hostname: cloudimg; } > meta-data
# customize that with your user info
$ cat << EOF > user-data
#cloud-config
- hosts: registry
sudo: yes
vars:
conjur_login: "{{ lookup('env', 'CONJUR_AUTHN_LOGIN') }}"
conjur_api_key: "{{ lookup('env', 'CONJUR_AUTHN_API_KEY') }}"
conjur_policy_id: "{{ lookup('env', 'CONJUR_POLICY_ID') }}"
tasks:
- name: add docker repository Key
apt_key: keyserver=keyserver.ubuntu.com id=36A1D7869245C8950F966E92D8576A8BA88D21E9
tags: prepare
@asakura
asakura / user-data
Created December 19, 2014 14:25
user-data example
#cloud-config
manage_etc_hosts: localhost
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCcKhUGgzZTycTHQPjfd12MeSaFYl2pomE0pvzJuQVBJHAdMg0mTLphtAA7jUVp1mMaLXhONVZMTqyy9Jkb0lhZK6wzDC+MwyqB543Q/umHpRccULOWfjvB0S33ZA6414287kshqbH4tfkQ5+2lJitj2FDUIck9BPwUBSvOeyDsOuU6PeCY8qD2czvKk2QN96h2SngibuQ+ty7nLdqIGedAojevKk9YwtopTRey3Xxe4g++Ew4Jc40jH9oY0KHVS0vIVeKkpJow7W4xmS5zviMfdejjhmirDErpYP6DqIJwl0wlBn/D/ghoWgYfUzuBjUBQ+sHZRQ+mgUW3ZTaHdzBgwVLKuzckCovdq6fA3wL+x3rexR1avhR/AxnMmc4hFc5/TGhqTs9oRKRwo7A6wrufn7SKtrbbtoAB6tfwT+upUxqwTpuZVitLTbuUSafeKUSt09p/H0kvutwpenypBHunFpa1i+Z/pd/MJ+FIedJqpojFfFmYIyHktwO3rIigJnzdmuQF+oo3c/9Xuz8+vazfFVCTLEAzIkokIqJop04o4GCiZzFHZTj5p85vxnfZMgBiHnZ5ox6h6mpzwomJPJWf4cSokh3bLuB7lUVWbLlv7/HklEKSZpBAKN0v7qogEshCCLGH9UX8HkpWJcM81ikXri2dUCsxz3dcXJ54q1glfw== nikolai.sevostjanov@gmail.com
# ---- RUN ON HOST
sudo apt-get install -y python-software-properties
sudo apt-add-repository -y ppa:ubuntu-lxc/stable
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install -y lxc
sudo lxc-create -t ubuntu -n conjur-baseimage -- -r precise
# fstab
# Prepare your host machine
```sh-session
sudo apt-get install -y python-software-properties
sudo apt-add-repository -y ppa:ubuntu-lxc/stable
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install -y lxc
sudo modprobe ip6table_filter
```
@asakura
asakura / gist:294c6612a3b86adc8a20
Created February 11, 2015 18:02
dnsmasq for docker, static address for lxc
sudo -i
service docker stop
lxc-stop -n conjur-standalone-01
service lxc-net stop
service lxc stop
# Delete old bridges
ip link set dev docker0 down
brctl delbr docker0
#include <stdint.h>
#include "algos_number.h"
void* algos_number_alloc(algos_number_kind kind, void* value) {
algos_number *number = (algos_number*)enif_alloc(sizeof(algos_number));
if (number == NULL) {
exit(1);
}