Skip to content

Commit

Permalink
Merge pull request ManageIQ#257 from yrudman/allow-httpd-password-to-…
Browse files Browse the repository at this point in the history
…have-dollar-sign

Allow httpd password to have dollar sign in it
  • Loading branch information
bdunne authored Aug 15, 2017
2 parents 193b7f2 + 782e12a commit 7bea4f3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def configure_sssd

def configure_ipa_http_service
say("Configuring IPA HTTP Service and Keytab ...")
AwesomeSpawn.run!("/bin/echo \"#{@password}\" | /usr/bin/kinit #{@principal}")
AwesomeSpawn.run!("/usr/bin/kinit", :params => [@principal], :stdin_data => @password)
service = Principal.new(:hostname => @host, :realm => realm, :service => "HTTP", :ca_name => "ipa")
service.register
AwesomeSpawn.run!(IPA_GETKEYTAB, :params => {"-s" => @ipaserver, "-k" => HTTP_KEYTAB, "-p" => service.name})
Expand Down
22 changes: 22 additions & 0 deletions spec/appliance_console/external_httpd_authentication_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require "active_support/all"
require "appliance_console/external_httpd_authentication"
require "appliance_console/prompts"
require "appliance_console/principal"
require "linux_admin"

describe ApplianceConsole::ExternalHttpdAuthentication do
Expand Down Expand Up @@ -162,4 +163,25 @@
subject.post_activation
end
end

context "#configure_ipa_http_service" do
before do
allow(subject).to receive(:say)
service = double("Principal")
allow(ApplianceConsole::Principal).to receive(:new).and_return(service)
allow(service).to receive(:register)
allow(service).to receive(:name)
allow(FileUtils).to receive(:chown)
allow(FileUtils).to receive(:chmod)
allow(AwesomeSpawn).to receive(:run!).with("/usr/sbin/ipa-getkeytab", anything)
end

it "accept symbol '$' as part of password string" do
subject.instance_variable_set("@password", "$my_password")
expect(AwesomeSpawn).to receive(:run!).exactly(1).with("/usr/bin/kinit",
:params => ["admin"],
:stdin_data => "$my_password")
subject.send(:configure_ipa_http_service)
end
end
end

0 comments on commit 7bea4f3

Please sign in to comment.