Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

Commit

Permalink
Pre-publish polish
Browse files Browse the repository at this point in the history
- Correct README.md
- Relocate library specs to spec/unit/libraries so foodcritic doesn't catch it
- Update metadata.rb to 4.1.0
- Update CHANGELOG.md
- Add chefignore (matches current generator in chef generate cookbook)
- Update .gitignore to match current generator in chef generate cookbook
- Normalize Berksfile
  • Loading branch information
Charles Johnson committed Jun 11, 2015
1 parent b33c3f5 commit 0921176
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 17 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Berksfile.lock
\#*#
.*.sw[a-z]
*.un~
/cookbooks

# Bundler
Gemfile.lock
Expand Down
5 changes: 2 additions & 3 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
source 'https://supermarket.chef.io'

metadata

group :integration do
cookbook 'test', :path => 'test/fixtures/cookbooks/test'
cookbook 'postfix'
end

metadata
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ openssl Cookbook CHANGELOG
==========================
This file is used to list changes made in each version of the openssl cookbook.

v4.1.0 (2015-06-11)
-------------------
- Add new random_password Mixin (Thanks, Seth!)
- Rewritten README.md
- Refactor specs
- Clear Rubocop violations


v4.0.0 (2015-02-19)
-------------------
- Reverting to Opscode module namespace
Expand Down
36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This cookbook provides tools for working with the Ruby OpenSSL library. It inclu
Requirements
------------

The `secure_password` method works on any platform with OpenSSL Ruby bindings installed. These bindings are already included with Chef.
The `random_password` mixin works on any platform with the Ruby SecureRandom module. This module are already included with Chef.

The `openssl_x509` lwrp works on any platform with the OpenSSL Ruby bindings installed. These bindings are already included with Chef.

Expand Down Expand Up @@ -63,17 +63,36 @@ When executed, this recipe will ensure that openssl is upgraded to the latest ve
Libraries & LWRPs
-----------------

### secure_password
There are two mixins packaged with this cookbook.

Most often this method will be used to generate a secure password for use in a variable or an attribute. For example, in a recipe:
### random_password (`OpenSSLCookbook::RandomPassword`)

The `RandomPassword` mixin can be used to generate secure random passwords in Chef cookbooks, usually for assignment to a variable or an attribute. `random_password` uses Ruby's SecureRandom library and is customizable.

#### Example Usage
```ruby
::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
node.set_unless[:my_password] = secure_password
Chef::Recipe.send(:include, OpenSSLCookbook::RandomPassword)
node.set['my_secure_attribute'] = random_password
node.set_unless['my_secure_attribute'] = random_password
node.set['my_secure_attribute'] = random_password(length: 50)
node.set['my_secure_attribute'] = random_password(length: 50, mode: :base64)
node.set['my_secure_attribute'] = random_password(length: 50, mode: :base64, encoding: 'ASCII')
```

Note that node attributes are widely accessible. Storing unencrypted passwords in node attributes, as in this example, carries risk.

### ~~secure_password (`Opscode::OpenSSL::Password`)~~

This library should be considered deprecated and will be removed in a future version. Please use `OpenSSLCookbook::RandomPassword` instead. The documentation is kept here for historical reasons.

#### ~~Example Usage~~
```ruby
::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
node.set_unless['my_password'] = secure_password
```

~~Note that node attributes are widely accessible. Storing unencrypted passwords in node attributes, as in this example, carries risk.~~

### openssl_x509

This LWRP generates self-signed, PEM-formatted x509 certificates. If no existing key is specified, the LWRP will automatically generate a passwordless key with the certificate.
Expand All @@ -91,7 +110,7 @@ This LWRP generates self-signed, PEM-formatted x509 certificates. If no existing
| `key_length` | Fixnum (Optional) | The desired Bit Length of the generated key. _Default: 2048_ |
| `owner` | String (optional) | The owner of all files created by the LWRP. _Default: "root"_ |
| `group` | String (optional) | The group of all files created by the LWRP. _Default: "root"_ |
| `mode` | The permission mode of all files created by the LWRP. _Default: "0400"_ |
| `mode` | String or Fixnum (Optional) | The permission mode of all files created by the LWRP. _Default: "0400"_ |

#### Example Usage

Expand All @@ -111,14 +130,12 @@ License and Author
------------------

Author:: Jesse Nelson (<[email protected]>)
Author:: Seth Vargo (<[email protected]>)
Author:: Charles Johnson (<[email protected]>)
Author:: Joshua Timberman (<[email protected]>)

=======




```text
Copyright:: 2009-2015, Chef Software, Inc <[email protected]>
Expand All @@ -134,4 +151,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```

95 changes: 95 additions & 0 deletions chefignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Put files/directories that should be ignored in this file when uploading
# or sharing to the community site.
# Lines that start with '# ' are comments.

# OS generated files #
######################
.DS_Store
Icon?
nohup.out
ehthumbs.db
Thumbs.db

# SASS #
########
.sass-cache

# EDITORS #
###########
\#*
.#*
*~
*.sw[a-z]
*.bak
REVISION
TAGS*
tmtags
*_flymake.*
*_flymake
*.tmproj
.project
.settings
mkmf.log

## COMPILED ##
##############
a.out
*.o
*.pyc
*.so
*.com
*.class
*.dll
*.exe
*/rdoc/

# Testing #
###########
.watchr
.rspec
spec/*
spec/fixtures/*
test/*
features/*
Guardfile
Procfile

# SCM #
#######
.git
*/.git
.gitignore
.gitmodules
.gitconfig
.gitattributes
.svn
*/.bzr/*
*/.hg/*
*/.svn/*

# Berkshelf #
#############
Berksfile
Berksfile.lock
cookbooks/*
tmp

# Cookbooks #
#############
CONTRIBUTING

# Strainer #
############
Colanderfile
Strainerfile
.colander
.strainer

# Vagrant #
###########
.vagrant
Vagrantfile

# Travis #
##########
.travis.yml
3 changes: 2 additions & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
license 'Apache 2.0'
description 'Provides a library with a method for generating secure random passwords.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '4.0.0'
version '4.1.0'

recipe 'openssl', 'Empty, this cookbook provides a library, see README.md'
recipe 'upgrade', 'Upgrade OpenSSL library and restart dependent services'

# chef-sugar greatly reduces the amount of code required to check
# conditionals for the attributes used in the upgrader recipe.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require_relative '../spec_helper'
require_relative '../../libraries/random_password'
require 'spec_helper'
require_relative '../../../libraries/random_password'

describe OpenSSLCookbook::RandomPassword do
let(:instance) do
Expand Down

0 comments on commit 0921176

Please sign in to comment.