Module: Localhost::System::Darwin
- Defined in:
- lib/localhost/system/darwin.rb
Overview
Darwin specific system operations.
Class Method Summary collapse
-
.install(certificate) ⇒ Object
Install a certificate into the system trust store.
Class Method Details
.install(certificate) ⇒ Object
Install a certificate into the system trust store.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/localhost/system/darwin.rb', line 13 def self.install(certificate) login_keychain = File.("~/Library/Keychains/login.keychain-db") success = system( "security", "add-trusted-cert", "-d", "-r", "trustRoot", "-k", login_keychain, certificate ) if success $stderr.puts "Installed certificate to #{login_keychain}" return true else raise "Failed to install certificate: #{certificate}" end end |