Module: VagrantPlugins::CaCertificates::Cap::Redhat::UpdateCertificateBundle

Defined in:
lib/vagrant-ca-certificates/cap/redhat/update_certificate_bundle.rb

Overview

Capability for configuring the certificate bundle on Redhat.

Class Method Summary collapse

Class Method Details

.update_certificate_bundle(m) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vagrant-ca-certificates/cap/redhat/update_certificate_bundle.rb', line 9

def self.update_certificate_bundle(m)
  m.communicate.tap do |sh|
    if Redhat.legacy_certificate_bundle?(sh)
      sh.sudo('find /etc/pki/tls/private -type f -exec cat {} \; | cat /etc/pki/tls/certs/ca-bundle.crt - > /etc/pki/tls/ca.private.crt')
      sh.sudo('/bin/ln -fsn /etc/pki/tls/ca.private.crt /etc/pki/tls/cert.pem')
      sh.sudo('/bin/ln -fsn /etc/pki/tls/ca.private.crt /etc/pki/tls/certs/ca-bundle.crt')
      sh.execute("if [ ! -z \"$JAVA_HOME\" ]; then \\\nfind /etc/pki/tls/private -type f -exec $JAVA_HOME/bin/keytool -importcert \\\n -trustcacerts -noprompt -storepass changeit \\\n -keystore $JAVA_HOME/jre/lib/security/cacerts -file {} \\\\; \\\nelse true; fi\n      SCRIPT\n    else\n      sh.sudo('update-ca-trust enable')\n      sh.sudo('update-ca-trust extract')\n    end\n  end\nend\n", shell: '/bin/bash', sudo: true)