Skip to content

Commit

Permalink
COOK-228, add support for debian-sys-maint user
Browse files Browse the repository at this point in the history
This also introduces grants.sql, and we'll set up a replication
user here. And setting the password for these two users + root
by moving the openssl random generation to a new library.
  • Loading branch information
jtimberman committed Dec 23, 2009
0 parents commit 7d4d8ac
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
= DESCRIPTION:

Library provides a method to generate secure passwords for use in recipes.

= REQUIREMENTS:

OpenSSL Ruby bindings must be 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 (<[email protected]>)

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.
37 changes: 37 additions & 0 deletions 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 <[email protected]>
#
# 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
6 changes: 6 additions & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
maintainer "Opscode, Inc."
maintainer_email "[email protected]"
license "Apache 2.0"
description "Installs/Configures openssl"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "0.1"
19 changes: 19 additions & 0 deletions 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 7d4d8ac

Please sign in to comment.