Skip to content

Instantly share code, notes, and snippets.

@kgilpin
kgilpin / gist:3537559
Created August 30, 2012 18:55
Archive a Jenkins Ruby Gem artifact to a Conjur Dataset
cd pkg && INSCITIV_ENV=stage rvm 1.9.2@myproject do bundle exec ../bin/conjur datafile:upload "Jenkins artifacts: myproject" *.gem
@kgilpin
kgilpin / executor.rb
Created May 24, 2012 13:34
Command execution with realtime feedback
exit_code = Open3.popen3(env, cmd, opts) do |stdin, stdout, stderr, thread|
stdin.close
# Create a thread to read from each stream
threads = [[:stdout, stdout], [:stderr, stderr]].collect do |method, stream|
Thread.new do
until (line = stream.gets).nil?
callback.send(method, line)
end
end
end
@kgilpin
kgilpin / blue-green.rb
Created June 13, 2015 20:14
Simple blue/green model
# Simple script which creates two groups, blue and green. Each
# group contains a couple of users. The groups have different permissions
# on 'webservice' resources. In an SDF gatekeeper scenario, the 'blue'
# team will be able to 'read' service a, and the 'green' team will be
# able to 'read' service b. Neither team can perform any action besides 'read'.
# The owner of the 'webservice' resources (which is the user that runs this script)
# has all permissions on all records, via Conjur ownership.
# Create the blue team
blue = group "blue" do
@kgilpin
kgilpin / Notes
Created December 8, 2014 21:33
Conjur commands
Upgrade Conjur CLI
$ sudo /opt/conjur/embedded/bin/gem install conjur-cli --no-rdoc --no-ri
@kgilpin
kgilpin / basic-org.rb
Last active August 29, 2015 13:57
Conjur Policy - Basic Organization
test_layer = nil
group "security_admin" do
owns do
scope "v1" do
ops = group "ops" do
owns do
test_layer = layer "test"
layer "production"
end