This repository has been archived by the owner on Jan 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ca_truster job to trust CA certs configured by manifest
[#83168476]
- Loading branch information
Luan Santos and Serguei Filimonov
committed
Mar 5, 2015
1 parent
6b2be86
commit 064fcac
Showing
13 changed files
with
333 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
check process ca_truster with pidfile /var/vcap/sys/run/ca_truster/ca_truster.pid | ||
start program "/var/vcap/jobs/ca_truster/bin/ca_truster_ctl start" | ||
stop program "/var/vcap/jobs/ca_truster/bin/ca_truster_ctl stop" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
name: ca_truster | ||
|
||
description: "CA truster adds CA certificates to the trusted list. It is intented do be included in every VM." | ||
|
||
templates: | ||
ca_truster.sh.erb: bin/ca_truster.sh | ||
ca_truster_ctl.erb: bin/ca_truster_ctl | ||
|
||
packages: | ||
- common | ||
|
||
properties: | ||
ca_truster.certificates: | ||
description: "CA certificates to trust." | ||
default: [] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
trust_cas() { | ||
set -e -x | ||
|
||
<% p("ca_truster.certificates", []).each_with_index do |certificate, i| %> | ||
echo "adding CA /usr/local/share/ca-certificates/cf-ca-truster-<%= i %>.crt" | ||
echo '<%= certificate %>' > /usr/local/share/ca-certificates/cf-ca-truster-<%= i %>.crt | ||
<% end %> | ||
update-ca-certificates | ||
echo 1 > ${RUN_DIR}/ca_truster.pid | ||
} | ||
|
||
untrust_cas() { | ||
set -e -x | ||
|
||
rm -f /usr/local/share/ca-certificates/cf-ca-truster-*.crt | ||
update-ca-certificates --fresh | ||
rm -f ${RUN_DIR}/ca_truster.pid | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
export CA_TRUSTER_JOB_DIR=/var/vcap/jobs/ca_truster | ||
|
||
RUN_DIR=/var/vcap/sys/run/ca_truster | ||
|
||
source /var/vcap/packages/common/utils.sh | ||
source $CA_TRUSTER_JOB_DIR/bin/ca_truster.sh | ||
|
||
case $1 in | ||
|
||
start) | ||
mkdir -p $RUN_DIR | ||
trust_cas | ||
;; | ||
|
||
stop) | ||
untrust_cas | ||
;; | ||
|
||
*) | ||
echo "Usage: ca_truster_ctl {start|stop}" | ||
;; | ||
|
||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.