Skip to content

Commit

Permalink
Merge pull request #18092 from carbonin/hex_ansible_passwords
Browse files Browse the repository at this point in the history
Don't use special characters in ansible passwords

(cherry picked from commit 0a6e60e)

https://bugzilla.redhat.com/show_bug.cgi?id=1638009
  • Loading branch information
bdunne authored and simaishi committed Oct 12, 2018
1 parent cf812e1 commit a00ae17
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/embedded_ansible.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def find_or_create_database_authentication
end

def generate_password
SecureRandom.base64(18).tr("+/", "-_")
SecureRandom.hex(18)
end

def miq_database
Expand Down
9 changes: 9 additions & 0 deletions spec/lib/embedded_ansible_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,5 +231,14 @@
expect(auth).to have_attributes(:userid => "awx", :password => "mypassword")
end
end

describe "#generate_password (private)" do
it "doesn't include special characters" do
100.times do
pass = subject.send(:generate_password)
expect(pass).to match(/^[a-zA-Z0-9]+$/)
end
end
end
end
end

0 comments on commit a00ae17

Please sign in to comment.