mirror of
https://github.com/inspec/inspec
synced 2024-09-20 06:21:56 +00:00
use stdlib SecureRandom to generate a password
Replaces the now-yanked passgen gem with something available in the Ruby standard library. Why `.alphanumeric(72)`? This method will reliably crank out 72-character strings that meet the upper, lower, and numeric requirement of Azure. From the docs on the Azure terraform provider: > NOTE: admin_password must be between 6-72 characters long and must > satisfy at least 3 of password complexity requirements from the > following: > 1. Contains an uppercase character > 2. Contains a lowercase character > 3. Contains a numeric digit > 4. Contains a special character So, this should suffice. Signed-off-by: Robb Kidd <robb@thekidds.org>
This commit is contained in:
parent
8bcbaf6967
commit
30a4f8ea58
2 changed files with 2 additions and 3 deletions
1
Gemfile
1
Gemfile
|
@ -28,7 +28,6 @@ group :test do
|
|||
gem "mocha", "~> 1.1"
|
||||
gem "ruby-progressbar", "~> 1.8"
|
||||
gem "webmock", "~> 3.0"
|
||||
gem "passgen"
|
||||
gem "m"
|
||||
gem "pry", "~> 0.10"
|
||||
gem "pry-byebug"
|
||||
|
|
4
Rakefile
4
Rakefile
|
@ -3,7 +3,6 @@
|
|||
require "bundler"
|
||||
require "bundler/gem_helper"
|
||||
require "rake/testtask"
|
||||
require "passgen"
|
||||
require "train"
|
||||
require_relative "tasks/maintainers"
|
||||
require_relative "tasks/spdx"
|
||||
|
@ -252,8 +251,9 @@ namespace :test do
|
|||
creds = connection.options
|
||||
|
||||
# Determine the storage account name and the admin password
|
||||
require "securerandom"
|
||||
sa_name = (0...15).map { (65 + rand(26)).chr }.join.downcase
|
||||
admin_password = Passgen.generate(length: 12, uppercase: true, lowercase: true, symbols: true, digits: true)
|
||||
admin_password = SecureRandom.alphanumeric(72)
|
||||
|
||||
# Use the first 4 characters of the storage account to create a suffix
|
||||
suffix = sa_name[0..3]
|
||||
|
|
Loading…
Reference in a new issue