trocla-ruby2 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.document +4 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +10 -0
  5. data/CHANGELOG.md +71 -0
  6. data/Gemfile +51 -0
  7. data/LICENSE.txt +15 -0
  8. data/README.md +351 -0
  9. data/Rakefile +53 -0
  10. data/bin/trocla +148 -0
  11. data/ext/redhat/rubygem-trocla.spec +120 -0
  12. data/lib/VERSION +4 -0
  13. data/lib/trocla.rb +162 -0
  14. data/lib/trocla/default_config.yaml +47 -0
  15. data/lib/trocla/encryptions.rb +54 -0
  16. data/lib/trocla/encryptions/none.rb +10 -0
  17. data/lib/trocla/encryptions/ssl.rb +51 -0
  18. data/lib/trocla/formats.rb +54 -0
  19. data/lib/trocla/formats/bcrypt.rb +7 -0
  20. data/lib/trocla/formats/md5crypt.rb +6 -0
  21. data/lib/trocla/formats/mysql.rb +6 -0
  22. data/lib/trocla/formats/pgsql.rb +7 -0
  23. data/lib/trocla/formats/plain.rb +7 -0
  24. data/lib/trocla/formats/sha1.rb +7 -0
  25. data/lib/trocla/formats/sha256crypt.rb +6 -0
  26. data/lib/trocla/formats/sha512crypt.rb +6 -0
  27. data/lib/trocla/formats/ssha.rb +9 -0
  28. data/lib/trocla/formats/sshkey.rb +46 -0
  29. data/lib/trocla/formats/x509.rb +197 -0
  30. data/lib/trocla/store.rb +80 -0
  31. data/lib/trocla/stores.rb +39 -0
  32. data/lib/trocla/stores/memory.rb +56 -0
  33. data/lib/trocla/stores/moneta.rb +58 -0
  34. data/lib/trocla/util.rb +71 -0
  35. data/lib/trocla/version.rb +22 -0
  36. data/spec/data/.keep +0 -0
  37. data/spec/spec_helper.rb +290 -0
  38. data/spec/trocla/encryptions/none_spec.rb +22 -0
  39. data/spec/trocla/encryptions/ssl_spec.rb +26 -0
  40. data/spec/trocla/formats/x509_spec.rb +375 -0
  41. data/spec/trocla/store/memory_spec.rb +6 -0
  42. data/spec/trocla/store/moneta_spec.rb +6 -0
  43. data/spec/trocla/util_spec.rb +54 -0
  44. data/spec/trocla_spec.rb +248 -0
  45. data/trocla-ruby2.gemspec +104 -0
  46. metadata +202 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 355d934ac1a660fcb57ec261cf7acf14db578271c48df4a5c15f8d7446f58da5
4
+ data.tar.gz: 691dd2559e062a49c7714d95e097af9850772dd9824f91bfdd3597e7d455b1c9
5
+ SHA512:
6
+ metadata.gz: a3e44c27be64910b184f5535e2e29d5ddc1c64dcdb023e46797b5e7c56aeabf12963892787e03ca9ce6385d3452d35c4391def8428ed70b492013f1008adcfbd
7
+ data.tar.gz: 1b701afda1780cbfd4212750f425fd8c3bc137f21b4c76092a0870f2365721769ca1bb8cf1ac034ee9a56e3e4349523d045b1a1f454eacc02e522c0a9c226f11
data/.document ADDED
@@ -0,0 +1,4 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ sudo: false
3
+ rvm:
4
+ - jruby
5
+ - jruby-18mode
6
+ - jruby-19mode
7
+ - 2.4.0
8
+ - 2.2.0
9
+ - 2.0.0
10
+ - 1.9.3
data/CHANGELOG.md ADDED
@@ -0,0 +1,71 @@
1
+ # Changelog
2
+
3
+ ## to 0.3.0
4
+
5
+ * Add open method to be able to immediately close a trocla store after using it - thanks martinpfeiffer
6
+ * Add typesafe charset - thanks hggh
7
+ * Support cost option for bcrypt
8
+ * address concurrency corner cases, when 2 concurrent threads or even processes
9
+ are currently calculating the same (expensive) format.
10
+ * parse additional options on cli (#39 & #46) - thanks fe80
11
+
12
+ ## to 0.2.3
13
+
14
+ 1. Add extended CA validity profiles
15
+ 1. Make it possible to define keyUsage
16
+
17
+ ## to 0.2.2
18
+
19
+ 1. Bugfix to render output correctly also on an already existing set
20
+ 1. Fix tests not working around midnight, due to timezone differences
21
+
22
+ ## to 0.2.1
23
+
24
+ 1. New Feature: Introduce a way to render specific formats, mainly this allows you to control the output of a specific format. See the x509 format for more information.
25
+
26
+ ## to 0.2.0
27
+
28
+ 1. New feature profiles: Introduce profiles to make it easy to have a default set of properties. See the profiles section for more information.
29
+ 1. New feature expiration: Make it possible that keys can have an expiration. See the expiration section for more information.
30
+ 1. Increase default password length to 16.
31
+ 1. Add a console safe password charset. It should provide a subset of chars that are easier to type on a physical keyboard.
32
+ 1. Fix a bug with encryptions while deleting all formats.
33
+ 1. Introduce pluggable stores, so in the future we are able to talk to different backends and not only moneta. For testing and inspiration a simple in memory storage backend was added.
34
+ 1. CHANGE: moneta's configuration for `adapter` & `adapter_options` now live under store_options in the configuration file. Till 0.3.0 old configuration entries will still be accepted.
35
+ 1. CHANGE: ssl_options is now known as encryption_options. Till 0.3.0 old configuration entries will still be accepted.
36
+ 1. Improve randomness when creating a serial number.
37
+ 1. Add a new charset: hexadecimal
38
+ 1. Add support for name constraints within the x509 format
39
+ 1. Clarify documentation of the set action, as well as introduce `--no-format` for the set action.
40
+
41
+ ## to 0.1.3
42
+
43
+ 1. CHANGE: Self signed certificates are no longer CAs by default, actually they have never been due to a bug. If you want that a certificate is also a CA, you *must* pass `become_ca: true` to the options hash. But this makes it actually possible, that you can even have certificate chains. Thanks for initial hint to [Adrien Bréfort](https://github.com/abrefort)
44
+ 1. Default keysize is now 4096
45
+ 1. SECURITY: Do not increment serial, rather choose a random one.
46
+ 1. Fixing setting of altnames, was not possible due to bug, till now.
47
+ 1. Add extended tests for the x509 format, that describe all the internal specialities and should give an idea how it can be used.
48
+ 1. Add cli option to list all formats
49
+
50
+ ## to 0.1.1
51
+
52
+ 1. fix storing data longer that public Keysize -11. Thanks [Timo Goebel](https://github.com/timogoebel)
53
+ 1. add a numeric only charset. Thanks [Jonas Genannt](https://github.com/hggh)
54
+ 1. fix reading key expire time. Thanks [asquelt](https://github.com/asquelt)
55
+
56
+ ## to 0.1.0
57
+
58
+ 1. Supporting encryption of the backends. Many thanks to Thomas Gelf
59
+ 1. Adding a windows safe password charset
60
+
61
+ ## to 0.0.12
62
+
63
+ 1. change from sha1 signature for the x509 format to sha2
64
+ 1. Fix an issue where shellsafe characters might have already been initialized with shell-unsafe characters. Plz review any shell-safe character passwords regarding this problem. See the [fix](https://github.com/duritong/trocla/pull/19) for more information. Thanks [asquelt](https://github.com/asquelt) for the fix.
65
+
66
+ ## to 0.0.8
67
+
68
+ 1. be sure to update as well the moneta gem, trocla now uses the official moneta releases and supports current avaiable versions.
69
+ 1. Options for moneta's backends have changed. For example, if you are using the yaml-backend you will likely need to change the adapter option `:path:` to `:file:` to match moneta's new API.
70
+ 1. **IMPORTANT:** If you are using the yaml backend you need to migrate the current data *before* using the new trocla version! You can migrate the datastore by using the following two sed commands: `sed -i 's/^\s\{3\}/ /' /PATH/TO/trocla_data.yaml` && `sed -i '/^\s\{2\}value\:/d' /PATH/TO/trocla_data.yaml`.
71
+ 1. **SECURITY:** Previous versions of trocla used quite a simple random generator. Especially in combination with the puppet `fqdn_rand` function, you likely have very predictable random passwords and I recommend you to regenerate all randomly generated passwords! Now!
data/Gemfile ADDED
@@ -0,0 +1,51 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ if RUBY_VERSION.to_f <= 2.2
7
+ gem 'rack', '< 2.0'
8
+ end
9
+
10
+ if RUBY_VERSION.to_f < 2.1
11
+ gem 'nokogiri', '< 1.7'
12
+ end
13
+
14
+ if RUBY_VERSION.to_f > 1.8
15
+ gem "moneta"
16
+ gem "highline"
17
+ else
18
+ gem "moneta", "~> 0.7.20"
19
+ gem "highline", "~> 1.6.2"
20
+ gem 'rake', '< 11'
21
+ gem 'git', '< 1.3'
22
+ end
23
+
24
+ if defined?(RUBY_ENGINE) && (RUBY_ENGINE == 'jruby')
25
+ gem 'jruby-openssl'
26
+ end
27
+ gem "bcrypt"
28
+ gem "sshkey"
29
+
30
+ # Add dependencies to develop your gem here.
31
+ # Include everything needed to run rake, tests, features, etc.
32
+ group :development do
33
+ if RUBY_VERSION.to_f > 1.8
34
+ gem "rspec"
35
+ gem "rdoc"
36
+ if RUBY_VERSION.to_f < 2.2
37
+ gem 'jeweler', '< 2.2'
38
+ else
39
+ gem "jeweler"
40
+ end
41
+ if RUBY_VERSION.to_f < 2.0
42
+ gem 'public_suffix', '~> 1.4.6'
43
+ end
44
+ else
45
+ gem "rspec", "~> 2.4"
46
+ gem "rdoc", "~> 3.8"
47
+ gem "jeweler", "~> 1.6"
48
+ gem "addressable", "~> 2.3.8"
49
+ end
50
+ gem 'rspec-pending_for'
51
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,15 @@
1
+ Trocla - a simple password generator and storage
2
+ Copyright (C) 2011-2015 Marcel Haerry
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU General Public License as published by
6
+ the Free Software Foundation, either version 3 of the License, or
7
+ any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU General Public License for more details.
13
+
14
+ You should have received a copy of the GNU General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
data/README.md ADDED
@@ -0,0 +1,351 @@
1
+ # trocla
2
+ [![Build Status](https://travis-ci.org/duritong/trocla.png)](https://travis-ci.org/duritong/trocla)
3
+
4
+ Trocla provides you a simple way to create and store (random) passwords on a
5
+ central server, which can be retrieved by other applications. An example for
6
+ such an application is puppet and trocla can help you to not store any
7
+ plaintext or hashed passwords in your manifests by keeping these passwords only
8
+ on your puppetmaster.
9
+
10
+ Furthermore it provides you a simple cli that helps you to modify the password
11
+ storage from the cli.
12
+
13
+ Trocla does not only create and/or store a plain password, it is also able to
14
+ generate (and store) any kind of hashed passwords based on the plain password.
15
+ As long as the plain password is preset, trocla is able to generate any kind
16
+ of hashed passwords through an easy extendible plugin system.
17
+
18
+ It is not necessary to store the plain password on the server, you can also
19
+ just feed trocla with the hashed password and use that in your other tools.
20
+ A common example for that is that you let puppet retrieve (and hence create)
21
+ a salted sha512 password for a user. This will then store the salted sha512 of
22
+ a random password AND the plain text password in trocla. Later you can
23
+ retrieve (by deleting) the plain password and send it to the user. Puppet
24
+ will still simply retrieve the hashed password that is stored in trocla,
25
+ while the plain password is not anymore stored on the server.
26
+
27
+ Be default trocla uses moneta to store the passwords and can use any kind of
28
+ key/value based storage supported by moneta for trocla. By default it uses a
29
+ simple yaml file.
30
+ However, since version 0.2.0 trocla also supports a pluggable storage backend
31
+ which allows you to write your custom backend. See more about stores below.
32
+
33
+ Trocla can also be integrated into [Hiera](https://docs.puppetlabs.com/hiera/) by using ZeroPointEnergy's [hiera-backend](https://github.com/ZeroPointEnergy/hiera-backend-trocla).
34
+
35
+ ## Usage
36
+
37
+ ### create
38
+
39
+ Assuming that we have an empty trocla storage.
40
+
41
+ trocla create user1 plain
42
+
43
+ This will create (if not already stored in trocla) a random password and
44
+ store its plain text under key user1. The password will also be returned
45
+ by trocla.
46
+
47
+ trocla create user2 mysql
48
+
49
+ This will create a random password and store its plain and mysql-style hashed
50
+ sha1 password in trocla. The hashed password is returned.
51
+
52
+ trocla create user1 mysql
53
+
54
+ This will take the already stored plain text password of key user1 and generate
55
+ and store the mysql-style hashed sha1 password.
56
+
57
+ It is possible that certain hash formats require additional options. For example
58
+ the pgsql hash requires also the user to create the md5 hash for the password.
59
+ You can pass these additional requirements as yaml-based strings to the format:
60
+
61
+ trocla create user1 pgsql 'username: user1'
62
+
63
+ This will create a pgsql password hash using the username user1.
64
+
65
+ Valid global options are:
66
+
67
+ * length: int - Define any lenght that a newly created password should have. Default: 16 - or whatever you define in your global settings.
68
+ * charset: (default|alphanumeric|shellsafe) - Which set of chars should be used for a random password? Default: default - or whatever you define in your global settings.
69
+ * profiles: a profile name or an array of profiles matching a profile_name in your configuration. Learn more about profiles below.
70
+ * random: boolean - Whether we allow creation of random passwords or we expect a password to be preset. Default: true - or whatever you define in your global settings.
71
+ * expires: An integer indicating the amount of seconds a value (e.g. password) is available. After expiration a value will not be available anymore and trying to `get` this key will return no value (nil). Meaning that calling create after expiration, would create a new password automatically. There is more about expiration in the storage backends section.
72
+ * render: A hash providing flags for formats to render the output specifially. This is a global option, but support depends on a per format basis.
73
+
74
+ Example:
75
+
76
+ trocla create some_shellsafe_password plain 'charset: shellsafe'
77
+ trocla create another_alphanumeric_20_char_password plain "charset: alphanumeric
78
+ length: 20"
79
+
80
+ ### get
81
+
82
+ Get simply returns a stored password. It will not create a new password.
83
+
84
+ Assuming that we are still working with the same storage
85
+
86
+ trocla get user2 plain
87
+
88
+ will return the plain text password of the key user2.
89
+
90
+ trocla get user3 plain
91
+
92
+ This will return nothing, as no password with this format have been stored so
93
+ far.
94
+
95
+ ### set
96
+
97
+ trocla set user3 plain
98
+
99
+ This will ask you for a password and set it under the appropriate key/format.
100
+ We expect a plain password to be entered and will format the password with
101
+ the selected format before storing it.
102
+
103
+ trocla set --password mysupersecretpassword user4 plain
104
+
105
+ This will take the password from the cli without asking you.
106
+
107
+ trocla set user5 mysql -p mysuperdbpassword
108
+
109
+ This will store a mysql sha1 hash for the key user5, without storing any kind
110
+ of plain text password.
111
+ If you like trocla not to format a password, as you are passing in an already
112
+ formatted password (like the sha512 hash), then you must use `--no-format` to
113
+ skip formatting. Like:
114
+
115
+ trocla set user5 sha512crypt --no-format -p '$6$1234$xxxx....'
116
+
117
+ You can also pipe in a password:
118
+
119
+ echo -n foo | trocla set user6 plain -p
120
+
121
+ or a file
122
+
123
+ cat some_file | trocla set user6 plain -p
124
+ trocla set user6 plain -p < some_file
125
+
126
+ ### reset
127
+
128
+ trocla reset user1 md5crypt
129
+
130
+ This will recreate the salted md5 shadow-style hash. However, it will not create
131
+ a new plain text passwords. Hence, this is mainly usefull to create new hashed
132
+ passwords based on new salts.
133
+
134
+ If the plain password of a key is resetted, every already hashed password is
135
+ deleted as well, as the hashes wouldn't match anymore the plain text password.
136
+
137
+ ### delete
138
+
139
+ trocla delete user1 plain
140
+
141
+ This will delete the plain password of the key user1 and return it.
142
+
143
+ ### formats
144
+
145
+ trocla formats
146
+
147
+ This will list all available and supported formats.
148
+
149
+ ## Attention
150
+
151
+ If you don't feed trocla initially with a hash and/or delete the generated
152
+ plain text passwords trocla will likely create a lot of plain text passwords
153
+ and store them on your machine/server. This is by intend and is all about which
154
+ problems (mainly passwords in configuration management manifests) trocla tries
155
+ to address. It is possible to store all passwords encrypted in the specific
156
+ backend.
157
+ See backend encryption for more information, however be aware that the key must
158
+ always also reside on the trocla node. So it mainly makes sense if you store
159
+ them on a remote backend like a central database server.
160
+
161
+ ## Formats
162
+
163
+ Most formats are straight forward to use. Some formats require some additional
164
+ options to work properly. These are documented here:
165
+
166
+ ### pgsql
167
+
168
+ Password hashes for PostgreSQL servers. Requires the option `username` to be set
169
+ to the username to which the password will be assigned.
170
+
171
+ ### bcrypt
172
+
173
+ You are able to tune the [cost factor of bcrypt](https://github.com/codahale/bcrypt-ruby#cost-factors) by passing the option `cost`.
174
+ Note: ruby bcrypt does not support a [cost > 31](https://github.com/codahale/bcrypt-ruby/blob/master/lib/bcrypt/password.rb#L45).
175
+
176
+ ### x509
177
+
178
+ This format takes a set of additional options. Required are:
179
+
180
+ subject: A subject for the target certificate. E.g. /C=ZZ/O=Trocla Inc./CN=test/emailAddress=example@example.com
181
+ OR
182
+ CN: The CN of the the target certificate. E.g. 'This is my self-signed certificate which doubles as CA'
183
+
184
+ Additional options are:
185
+
186
+ ca The trocla key of CA (imported into or generated within trocla) that
187
+ will be used to sign that certificate.
188
+ become_ca Whether the certificate should become a CA or not. Default: false,
189
+ to enable set it to true.
190
+ hash Hash to be used. Default sha2
191
+ keysize Keysize for the new key. Default is: 4096
192
+ serial Serial to be used, default is selecting a random one.
193
+ days How many days should the certificate be valid. Default 365
194
+ C instead within the subject string
195
+ ST instead within the subject string
196
+ L instead within the subject string
197
+ O instead within the subject string
198
+ OU instead within the subject string
199
+ emailAddress instead within the subject string
200
+ key_usages Any specific key_usages different than the default ones. If you specify
201
+ any, you must specify all that you want. If you don't want to have any,
202
+ you must specify an empty array.
203
+ altnames An array of subjectAltNames. By default for non CA certificates we
204
+ ensure that the CN ends up here as well. If you don't want that.
205
+ You need to pass an empty array.
206
+ name_constraints An array of domains that are added as permitted x509 NameConstraint.
207
+ By default, we do not add any contraint, meaning all domains are
208
+ signable by the CA, as soon as we have one item in the list, only
209
+ DNS entries matching this list are allowed. Be aware, that older
210
+ openssl versions have a bug with [leading dots](https://rt.openssl.org/Ticket/Display.html?id=3562) for name
211
+ constraints. So using them might not work everywhere as expected.
212
+
213
+ Output render options are:
214
+
215
+ certonly If set to true the x509 format will return only the certificate
216
+ keyonly If set to true the x509 format will return only the private key
217
+
218
+ ### sshkey
219
+
220
+ This format generate a ssh keypair
221
+
222
+ Additional options are:
223
+
224
+ type The ssh key type (rsa, dsa). Default: rsa
225
+ bits Specifies the number of bits in the key to create. Default: 2048
226
+ comment Specifies a comment.
227
+ passphrase Specifies a passphrase.
228
+
229
+ Output render options are:
230
+
231
+ pubonly If set to true the sshkey format will return only the ssh public key
232
+ privonly If set to true the sshkey format will return only the ssh private key
233
+
234
+ ## Installation
235
+
236
+ * Debian has trocla within its sid-release: `apt-get install trocla`
237
+ * For RHEL/CentOS 7 there is a [copr reporisotry](https://copr.fedoraproject.org/coprs/duritong/trocla/). Follow the help there to integrate the repository and install trocla.
238
+ * Trocla is also distributed as gem: `gem install trocla`
239
+
240
+ ## Configuration
241
+
242
+ Trocla can be configured in /etc/troclarc.yaml and in ~/.troclarc.yaml. A sample configuration file can be found in `lib/trocla/default_config.yaml`.
243
+ By default trocla configures moneta to store all data in /tmp/trocla.yaml
244
+
245
+ ### Profiles
246
+
247
+ It is possible to define profiles within the configuration file. The idea behind profiles are to make it easy to group together certain options for
248
+ automatic password generation.
249
+
250
+ Trocla ships with a default set of profiles, which are part of the `lib/trocla/default_config.yaml` configuration file. It is possible to override
251
+ the existing profiles within your own configuration file, as well as adding more. Note that the profiles part of the configuration file is merged
252
+ together and your configuration file has precedence.
253
+
254
+ The profiles part in the config is a hash where each entry consist of a name (key) and a hash of options (value).
255
+
256
+ Profiles make it especially easy to define a preset of options for SSL certificates as you will only need to set the certificate specific options,
257
+ while global options such as C, O or OU can be preset within the profile.
258
+
259
+ Profiles are used by setting the profiles option to a name of the pre-configured profiles, when passing options to the password option. On the cli
260
+ this looks like:
261
+
262
+ trocla create foo plain 'profiles: rootpw'
263
+
264
+ It is possible to pass mutliple profiles as an array, while the order will also reflect the precedence of the options.
265
+
266
+ Also it is possible to set a default profiles option in the options part of the configuration file.
267
+
268
+ ### Storage backends
269
+
270
+ Trocla has a pluggable storage backend, which allows you to choose the way that values are stored (persistently).
271
+ Such a store is a simple class that implements Trocla::Store and at the moment there are the following store implementations:
272
+
273
+ * Moneta - the default store using [moneta](https://rubygems.org/gems/moneta) to delegate storing the values
274
+ * Memory - simple inmemory backend. Mainly used for testing.
275
+
276
+ The backend is chosen based on the `store` configuration option. If it is a symbol, we expect it to be a store that we ship with trocla. Otherwise, we assume it to be a fully qualified ruby class name, that inherits from Trocla::Store. If trocla should load an additional library to be able to find your custom store class, you can set `store_require` to whatever should be passed to a ruby require statement.
277
+
278
+ Store backends can be configured through the `store_options` configuration.
279
+
280
+ #### Expiration
281
+
282
+ We expect storage backends to implement support for the `expires` option, so that keys expire after the passed amount of seconds. Furthermore a storage backend needs to implement the behaviour described by the rspec shared_example 'store_validation' section 'expiration'. Mainly:
283
+
284
+ * Expiration is always for all formats per key.
285
+ * Adding, deleting or updating a format will keep the existing expiration, but reset the planned expiration.
286
+ * While setting a new plain format will not only erase all other formats, but also erase/reset any expires.
287
+ * Setting a value with an expires option of 0 or false, will remove any existent expiration.
288
+
289
+ New backends should be tested using the provided shared example.
290
+
291
+ #### Moneta backends
292
+
293
+ Trocla uses moneta as its default storage backend and hence can store your passwords in any of moneta's supported backends. By default it uses the yaml backend, which is configured as followed:
294
+
295
+ ```YAML
296
+ store_options:
297
+ adapter: :YAML
298
+ adapter_options:
299
+ :file: '/tmp/trocla.yaml'
300
+ ```
301
+
302
+ In environments with multiple Puppet masters using an existing DB cluster might make sense. The configured user needs to be granted at least SELECT, INSERT, UPDATE, DELETE and CREATE permissions on your database:
303
+
304
+ ```YAML
305
+ store_options:
306
+ adapter: :Sequel
307
+ adapter_options:
308
+ :db: 'mysql://db.server.name'
309
+ :user: 'trocla'
310
+ :password: '***'
311
+ :database: 'trocladb'
312
+ :table: 'trocla'
313
+ ```
314
+
315
+ These examples are by no way complete, moneta has much more to offer. Please have a look at [moneta's documentation](https://github.com/minad/moneta/blob/master/README.md) for further information.
316
+
317
+ ### Backend encryption
318
+
319
+ By default trocla does not encrypt anything it stores. You might want to let Trocla encrypt all your passwords, at the moment the only supported way is SSL.
320
+ Given that often trocla's store is on the same system at it's being used, there might be little sense to encrypt everything while the encryption keys are on the same system. However, if you are for example using an existing DB cluster using backend encryption you won't store any plaintext passwords within the database system.
321
+
322
+ ### Backend SSL encryption
323
+
324
+ To enable SSL encryption (e.g. by using your puppet masters SSL keys), you need to set the following configuration options:
325
+
326
+ ```YAML
327
+ encryption: :ssl
328
+ encryption_options:
329
+ :private_key: '/var/lib/puppet/ssl/private_keys/trocla.pem'
330
+ :public_key: '/var/lib/puppet/ssl/public_keys/trocla.pem'
331
+ ```
332
+
333
+ ## Update & Changes
334
+
335
+ See [Changelog](CHANGELOG.md)
336
+
337
+ ## Contributing to trocla
338
+
339
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
340
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
341
+ * Fork the project
342
+ * Start a feature/bugfix branch
343
+ * Commit and push until you are happy with your contribution
344
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
345
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
346
+
347
+ ## Copyright
348
+
349
+ Copyright (c) 2011-2015 mh. See LICENSE.txt for
350
+ further details.
351
+