Skip to content
This repository was archived by the owner on Apr 8, 2021. It is now read-only.

Commit 090deb6

Browse files
Merge pull request #1 from osuosl-cookbooks/ramereth/cleanup
2 parents 63af461 + 65755ff commit 090deb6

File tree

16 files changed

+392
-42
lines changed

16 files changed

+392
-42
lines changed

.gitignore

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1+
.vagrant
12
*~
23
*#
34
.#*
45
\#*#
56
.*.sw[a-z]
67
*.un~
7-
pkg/
8-
9-
# Berkshelf
10-
.vagrant
11-
/cookbooks
12-
Berksfile.lock
138

149
# Bundler
1510
Gemfile.lock
1611
bin/*
1712
.bundle/*
1813

14+
# test kitchen
1915
.kitchen/
2016
.kitchen.local.yml
17+
18+
# Chef
19+
Berksfile.lock
20+
.zero-knife.rb
21+
Policyfile.lock.json

.kitchen.yml

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
---
22
driver:
3-
name: vagrant
4-
5-
provisioner:
6-
name: chef_solo
7-
8-
platforms:
9-
- name: ubuntu-14.04
10-
- name: centos-7.1
3+
flavor_ref: 'm1.medium'
114

125
suites:
136
- name: default
147
run_list:
15-
attributes:
8+
- recipe[osl-letsencrypt-boulder-server]

.rspec

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--format documentation --color

.rubocop.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
AllCops:
2+
Include:
3+
- '**/Berksfile'
4+
- '**/Cheffile'
5+
Exclude:
6+
- 'metadata.rb'
7+
8+
Style/NumericLiteralPrefix:
9+
EnforcedOctalStyle: zero_only
10+
11+
Metrics/LineLength:
12+
Max: 120
13+
14+
Style/IfUnlessModifier:
15+
MaxLineLength: 120
16+
17+
Style/WhileUntilModifier:
18+
MaxLineLength: 120
19+
20+
Metrics/BlockLength:
21+
Enabled: false

Berksfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
source "https://supermarket.chef.io"
1+
source 'https://supermarket.chef.io'
22

33
metadata

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
This is a cookbook for provisioning [Boulder][], an
44
[ACME-based][acme-spec] certificate authority, written in Go. The
55
Boulder application is an official effort of [Let's Encrypt
6-
project][letsencrypt].
6+
project][letsencrypt]. This particular cookbook is a fork of
7+
[letsencrypt-boulder-server](https://github.com/patcon/chef-letsencrypt-boulder-server)
8+
for use at the OSUOSL.
79

810
**Warning:** This cookbook was created for testing other cookbooks, not
911
production purposes.
1012

1113
## Supported Platforms
1214

13-
* Ubuntu 14.04
14-
* Centos 7
15+
* CentOS 6
16+
* CentOS 7
1517

1618
## Attributes
1719

Rakefile

+130-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,130 @@
1-
require 'stove/rake_task'
2-
Stove::RakeTask.new
1+
# Rake tasks
2+
3+
require 'rake'
4+
5+
require 'fileutils'
6+
require 'base64'
7+
require 'chef/encrypted_data_bag_item'
8+
require 'json'
9+
require 'openssl'
10+
11+
snakeoil_file_path = 'test/integration/data_bags/certificates/snakeoil.json'
12+
encrypted_data_bag_secret_path = 'test/integration/encrypted_data_bag_secret'
13+
14+
##
15+
# Run command wrapper
16+
def run_command(command)
17+
if File.exist?('Gemfile.lock')
18+
sh %(bundle exec #{command})
19+
else
20+
sh %(chef exec #{command})
21+
end
22+
end
23+
24+
##
25+
# Create a self-signed SSL certificate
26+
#
27+
def gen_ssl_cert
28+
name = OpenSSL::X509::Name.new [
29+
['C', 'US'],
30+
['ST', 'Oregon'],
31+
['CN', 'OSU Open Source Lab'],
32+
['DC', 'example']
33+
]
34+
key = OpenSSL::PKey::RSA.new 2048
35+
36+
cert = OpenSSL::X509::Certificate.new
37+
cert.version = 2
38+
cert.serial = 2
39+
cert.subject = name
40+
cert.public_key = key.public_key
41+
cert.not_before = Time.now
42+
cert.not_after = cert.not_before + 1 * 365 * 24 * 60 * 60 # 1 years validity
43+
44+
# Self-sign the Certificate
45+
cert.issuer = name
46+
cert.sign(key, OpenSSL::Digest::SHA1.new)
47+
48+
return cert, key
49+
end
50+
51+
##
52+
# Create a data bag item (with the id of snakeoil) containing a self-signed SSL
53+
# certificate
54+
#
55+
def ssl_data_bag_item
56+
cert, key = gen_ssl_cert
57+
Chef::DataBagItem.from_hash(
58+
'id' => 'snakeoil',
59+
'cert' => cert.to_pem,
60+
'key' => key.to_pem
61+
)
62+
end
63+
64+
##
65+
# Create the integration tests directory if it doesn't exist
66+
#
67+
directory 'test/integration'
68+
69+
##
70+
# Generates a 512 byte random sequence and write it to
71+
# 'test/integration/encrypted_data_bag_secret'
72+
#
73+
file encrypted_data_bag_secret_path => 'test/integration' do
74+
encrypted_data_bag_secret = OpenSSL::Random.random_bytes(512)
75+
open encrypted_data_bag_secret_path, 'w' do |io|
76+
io.write Base64.encode64(encrypted_data_bag_secret)
77+
end
78+
end
79+
80+
##
81+
# Create the certificates data bag if it doesn't exist
82+
#
83+
directory 'test/integration/data_bags/certificates' => 'test/integration'
84+
85+
##
86+
# Create the encrypted snakeoil certificate under
87+
# test/integration/data_bags/certificates
88+
#
89+
file snakeoil_file_path => [
90+
'test/integration/data_bags/certificates',
91+
'test/integration/encrypted_data_bag_secret'
92+
] do
93+
94+
encrypted_data_bag_secret = Chef::EncryptedDataBagItem.load_secret(
95+
encrypted_data_bag_secret_path
96+
)
97+
98+
encrypted_snakeoil_cert = Chef::EncryptedDataBagItem.encrypt_data_bag_item(
99+
ssl_data_bag_item, encrypted_data_bag_secret
100+
)
101+
102+
open snakeoil_file_path, 'w' do |io|
103+
io.write JSON.pretty_generate(encrypted_snakeoil_cert)
104+
end
105+
end
106+
107+
desc 'Create an Encrypted Databag Snakeoil SSL Certificate'
108+
task snakeoil: snakeoil_file_path
109+
110+
desc 'Create an Encrypted Databag Secret'
111+
task secret_file: encrypted_data_bag_secret_path
112+
113+
require 'rubocop/rake_task'
114+
desc 'Run RuboCop (style) tests'
115+
RuboCop::RakeTask.new(:style)
116+
117+
desc 'Run FoodCritic (lint) tests'
118+
task :lint do
119+
run_command('foodcritic --epic-fail any .')
120+
end
121+
122+
desc 'Run RSpec (unit) tests'
123+
task :unit do
124+
run_command('rspec')
125+
end
126+
127+
desc 'Run all tests'
128+
task test: [:style, :lint, :unit]
129+
130+
task default: :test

attributes/default.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
# limitations under the License.
1919
#
2020

21-
default['boulder']['revision'] = 'master'
21+
default['boulder']['revision'] = '2d33a9900cafe82993744fe73bd341fe47df2171'
22+
default['boulder']['host_aliases'] = []
2223

2324
default['boulder']['config']['boulder-config']['va']['portConfig']['httpPort'] = 80
2425
default['boulder']['config']['boulder-config']['va']['portConfig']['httpsPort'] = 443

chefignore

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Put files/directories that should be ignored in this file when uploading
2-
# or sharing to the community site.
2+
# to a chef-server or supermarket.
33
# Lines that start with '# ' are comments.
44

55
# OS generated files #
@@ -51,8 +51,16 @@ spec/*
5151
spec/fixtures/*
5252
test/*
5353
features/*
54+
examples/*
5455
Guardfile
5556
Procfile
57+
.kitchen*
58+
.rubocop.yml
59+
spec/*
60+
Rakefile
61+
.travis.yml
62+
.foodcritic
63+
.codeclimate.yml
5664

5765
# SCM #
5866
#######
@@ -69,13 +77,22 @@ Procfile
6977

7078
# Berkshelf #
7179
#############
80+
Berksfile
81+
Berksfile.lock
7282
cookbooks/*
7383
tmp
7484

85+
# Policyfile #
86+
##############
87+
Policyfile.rb
88+
Policyfile.lock.json
89+
7590
# Cookbooks #
7691
#############
77-
CONTRIBUTING
92+
CONTRIBUTING*
7893
CHANGELOG*
94+
TESTING*
95+
MAINTAINERS.toml
7996

8097
# Strainer #
8198
############
@@ -88,11 +105,3 @@ Strainerfile
88105
###########
89106
.vagrant
90107
Vagrantfile
91-
92-
# Travis #
93-
##########
94-
.travis.yml
95-
96-
# Test-Kitchen #
97-
################
98-
.kitchen

files/default/setup.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
#
3+
# Fetch dependencies of Boulder that are necessary for development or testing,
4+
# and configure database and RabbitMQ.
5+
#
6+
7+
set -ev
8+
9+
go get \
10+
bitbucket.org/liamstask/goose/cmd/goose \
11+
github.com/golang/lint/golint \
12+
github.com/golang/mock/mockgen \
13+
github.com/golang/protobuf/proto \
14+
github.com/golang/protobuf/protoc-gen-go \
15+
github.com/jsha/listenbuddy \
16+
github.com/kisielk/errcheck \
17+
github.com/mattn/goveralls \
18+
github.com/modocache/gover \
19+
github.com/tools/godep \
20+
golang.org/x/tools/cmd/stringer \
21+
golang.org/x/tools/cover &
22+
23+
(curl -sL https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz | \
24+
tar -xzv &&
25+
cd protobuf-2.6.1 && ./configure --prefix=$HOME && make && make install) &
26+
27+
# Set up rabbitmq exchange
28+
go run cmd/rabbitmq-setup/main.go -server amqp://boulder-rabbitmq &
29+
30+
# Wait for all the background commands to finish.
31+
wait
32+
33+
# Create the database and roles
34+
./test/create_db.sh

metadata.rb

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
name 'letsencrypt-boulder-server'
2-
maintainer 'Thijs Houtenbos'
3-
maintainer_email '[email protected]'
4-
license 'All rights reserved'
1+
name 'osl-letsencrypt-boulder-server'
2+
maintainer 'Oregon State University'
3+
maintainer_email '[email protected]'
4+
license 'apachev2'
55
description "Installs/Configures Boulder, the ACME-based CA server by Let's Encrypt."
66
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7-
issues_url 'https://github.com/patcon/chef-letsencrypt-boulder-server/issues'
8-
source_url 'https://github.com/patcon/chef-letsencrypt-boulder-server'
7+
issues_url 'https://github.com/osuosl-cookbooks/osl-letsencrypt-boulder-server/issues'
8+
source_url 'https://github.com/osuosl-cookbooks/osl-letsencrypt-boulder-server'
99
version '0.1.2'
1010

11-
supports 'ubuntu', '= 14.04'
12-
supports 'centos', '~> 7'
11+
supports 'centos', '~> 6.0'
12+
supports 'centos', '~> 7.0'
1313

1414
depends 'golang'
1515
depends 'rabbitmq'
1616
depends 'mariadb'
1717
depends 'build-essential'
18+
depends 'poise-python'
1819
depends 'yum'
1920
depends 'hostsfile'

0 commit comments

Comments
 (0)