@@ -168,6 +168,7 @@ the provided regular expression.
168
168
last Period).
169
169
* [ ` stdlib::ip_in_range ` ] ( #stdlibip_in_range ) : Returns true if the ipaddress is within the given CIDRs
170
170
* [ ` str2bool ` ] ( #str2bool ) : This converts a string to a boolean.
171
+ * [ ` str2saltedpbkdf2 ` ] ( #str2saltedpbkdf2 ) : Convert a string into a salted SHA512 PBKDF2 password hash like requred for OS X / macOS 10.8+
171
172
* [ ` str2saltedsha512 ` ] ( #str2saltedsha512 ) : This converts a string to a salted-SHA512 password hash (which is used for
172
173
OS X versions >= 10.7).
173
174
* [ ` strftime ` ] ( #strftime ) : This function returns formatted time.
@@ -4477,6 +4478,80 @@ See the function new() in Puppet for details what the Boolean data type supports
4477
4478
Returns: ` Any ` This attempt to convert to boolean strings that contain things like: Y,y, 1, T,t, TRUE,true to 'true' and strings that contain things
4478
4479
like: 0, F,f, N,n, false, FALSE, no to 'false'.
4479
4480
4481
+ ### str2saltedpbkdf2
4482
+
4483
+ Type: Ruby 3.x API
4484
+
4485
+ Convert a string into a salted SHA512 PBKDF2 password hash like requred for OS X / macOS 10.8+.
4486
+ Note, however, that Apple changes what's required periodically and this may not work for the latest
4487
+ version of macOS. If that is the case you should get a helpful error message when Puppet tries to set
4488
+ the pasword using the parameters you provide to the user resource.
4489
+
4490
+ #### Examples
4491
+
4492
+ ##### Plain text password and salt
4493
+
4494
+ ``` puppet
4495
+ $pw_info = str2saltedpbkdf2('Pa55w0rd', 'Using s0m3 s@lt', 50000)
4496
+ user { 'jdoe':
4497
+ ensure => present,
4498
+ iterations => $pw_info['interations'],
4499
+ password => $pw_info['password_hex'],
4500
+ salt => $pw_info['salt_hex'],
4501
+ }
4502
+ ```
4503
+
4504
+ ##### Sensitive password and salt
4505
+
4506
+ ``` puppet
4507
+ $pw = Sensitive.new('Pa55w0rd')
4508
+ $salt = Sensitive.new('Using s0m3 s@lt')
4509
+ $pw_info = Sensitive.new(str2saltedpbkdf2($pw, $salt, 50000))
4510
+ user { 'jdoe':
4511
+ ensure => present,
4512
+ iterations => unwrap($pw_info)['interations'],
4513
+ password => unwrap($pw_info)['password_hex'],
4514
+ salt => unwrap($pw_info)['salt_hex'],
4515
+ }
4516
+ ```
4517
+
4518
+ #### ` str2saltedpbkdf2() `
4519
+
4520
+ Convert a string into a salted SHA512 PBKDF2 password hash like requred for OS X / macOS 10.8+.
4521
+ Note, however, that Apple changes what's required periodically and this may not work for the latest
4522
+ version of macOS. If that is the case you should get a helpful error message when Puppet tries to set
4523
+ the pasword using the parameters you provide to the user resource.
4524
+
4525
+ Returns: ` Hash ` Provides a hash containing the hex version of the password, the hex version of the salt, and iterations.
4526
+
4527
+ ##### Examples
4528
+
4529
+ ###### Plain text password and salt
4530
+
4531
+ ``` puppet
4532
+ $pw_info = str2saltedpbkdf2('Pa55w0rd', 'Using s0m3 s@lt', 50000)
4533
+ user { 'jdoe':
4534
+ ensure => present,
4535
+ iterations => $pw_info['interations'],
4536
+ password => $pw_info['password_hex'],
4537
+ salt => $pw_info['salt_hex'],
4538
+ }
4539
+ ```
4540
+
4541
+ ###### Sensitive password and salt
4542
+
4543
+ ``` puppet
4544
+ $pw = Sensitive.new('Pa55w0rd')
4545
+ $salt = Sensitive.new('Using s0m3 s@lt')
4546
+ $pw_info = Sensitive.new(str2saltedpbkdf2($pw, $salt, 50000))
4547
+ user { 'jdoe':
4548
+ ensure => present,
4549
+ iterations => unwrap($pw_info)['interations'],
4550
+ password => unwrap($pw_info)['password_hex'],
4551
+ salt => unwrap($pw_info)['salt_hex'],
4552
+ }
4553
+ ```
4554
+
4480
4555
### str2saltedsha512
4481
4556
4482
4557
Type: Ruby 3.x API
0 commit comments