Skip to content

Commit

Permalink
Import openssl version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam committed Mar 2, 2012
1 parent 9092eea commit cac1620
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 0 deletions.
37 changes: 37 additions & 0 deletions cookbooks/openssl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Description
====

Provide a library method to generate secure random passwords in recipes.

Requirements
====

Works on any platform with OpenSSL Ruby bindings installed, which are a requirement for Chef anyway.

Usage
====

Most often this will be used to generate a secure password for an attribute.

include Opscode::OpenSSL::Password

set_unless[:my_password] = secure_password

License and Author
====

Author:: Joshua Timberman (<joshua@opscode.com>)

Copyright:: 2009-2011, Opscode, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
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.
37 changes: 37 additions & 0 deletions cookbooks/openssl/libraries/secure_password.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# Cookbook Name:: openssl
# Library:: secure_password
# Author:: Joshua Timberman <joshua@opscode.com>
#
# Copyright 2009, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
#

require 'openssl'

module Opscode
module OpenSSL
module Password
def secure_password
pw = String.new

while pw.length < 20
pw << ::OpenSSL::Random.random_bytes(1).gsub(/\W/, '')
end

pw
end
end
end
end
30 changes: 30 additions & 0 deletions cookbooks/openssl/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "openssl",
"description": "Provides a library with a method for generating secure random passwords.",
"long_description": "Description\n====\n\nProvide a library method to generate secure random passwords in recipes.\n\nRequirements\n====\n\nWorks on any platform with OpenSSL Ruby bindings installed, which are a requirement for Chef anyway.\n\nUsage\n====\n\nMost often this will be used to generate a secure password for an attribute.\n\n include Opscode::OpenSSL::Password\n\n set_unless[:my_password] = secure_password\n\nLicense and Author\n====\n\nAuthor:: Joshua Timberman (<joshua@opscode.com>)\n\nCopyright:: 2009-2011, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
"maintainer": "Opscode, Inc.",
"maintainer_email": "cookbooks@opscode.com",
"license": "Apache 2.0",
"platforms": {
},
"dependencies": {
},
"recommendations": {
},
"suggestions": {
},
"conflicting": {
},
"providing": {
},
"replacing": {
},
"attributes": {
},
"groupings": {
},
"recipes": {
"openssl": "Empty, this cookbook provides a library, see README.md"
},
"version": "1.0.0"
}
8 changes: 8 additions & 0 deletions cookbooks/openssl/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
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 "1.0.0"

recipe "openssl", "Empty, this cookbook provides a library, see README.md"
19 changes: 19 additions & 0 deletions cookbooks/openssl/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Cookbook Name:: openssl
# Recipe:: default
#
# Copyright 2009, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
#

0 comments on commit cac1620

Please sign in to comment.