Skip to content

Commit f3d5d52

Browse files
author
Luke Bakken
committed
Copy certs to /tmp to ensure they are readable
may as well enable security on Travis CI 2.0.7 support
1 parent b2a54b6 commit f3d5d52

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ env:
66
- RIAK_DOWNLOAD_URL=http://s3.amazonaws.com/downloads.basho.com/riak/2.1/2.1.4/ubuntu/trusty/riak_2.1.4-1_amd64.deb
77
script:
88
- sudo ./travis-ci/riak-install -d "$RIAK_DOWNLOAD_URL"
9-
- sudo ./setup-riak
9+
- sudo ./setup-riak -s
10+
- sudo riak-admin security disable
1011
- curl -4vvv localhost:8098/stats
1112
notifications:
1213
slack:

lib/common.bash

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@ set -o nounset
33

44
declare -r debug='false'
55

6+
function make_temp_dir
7+
{
8+
local template="${1:-tmp-$$}"
9+
if [[ $template != *XXXXXX ]]
10+
then
11+
template="$template.XXXXXX"
12+
fi
13+
mktemp -d -t "$template"
14+
}
15+
616
function make_temp_file
717
{
8-
local template="$1"
18+
local template="${1:-tmp-$$}"
919
if [[ $template != *XXXXXX ]]
1020
then
1121
template="$template.XXXXXX"

lib/riak_cluster_config.bash

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ function riak_cluster_config
5555

5656
if [[ $use_security == 'true' ]]
5757
then
58+
# NB: don't exit on error due to 2.0.7
59+
# TODO: set -o errexit when all Riak versions >= 2.1.4
60+
set +o errexit
5861
$riak_admin security enable
5962
$riak_admin security add-group test
6063

@@ -78,7 +81,6 @@ function riak_cluster_config
7881
$riak_admin security grant riak_core.get_bucket,riak_core.set_bucket,riak_core.get_bucket_type,riak_core.set_bucket_type on any to all
7982
$riak_admin security grant search.admin,search.query on any to all
8083

81-
set +o errexit
8284
$riak_admin security grant riak_ts.get on any to all
8385
$riak_admin security grant riak_ts.put on any to all
8486
$riak_admin security grant riak_ts.delete on any to all

setup-riak

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ function setup_cluster
160160
local -i https_port=0
161161
fi
162162

163-
164163
local adv_conf=''
165164
local riak_conf=''
166165
local riak_conf_orig=''
@@ -465,14 +464,29 @@ then
465464
security_cacert_file="$ca_path/certs/cacert.pem"
466465
security_cert_file="$ca_path/certs/riak-test-cert.pem"
467466
security_key_file="$ca_path/private/riak-test-key.pem"
467+
468468
for file in $security_cacert_file $security_cert_file $security_key_file
469469
do
470470
if [[ ! -f $file ]]
471471
then
472472
errexit "missing security file: $file"
473473
fi
474474
done
475-
pinfo "Using certificates in $ca_path"
475+
476+
declare -r tmp_ca_path="$(make_temp_dir)"
477+
478+
cp -f "$security_cacert_file" "$tmp_ca_path"
479+
security_cacert_file="$tmp_ca_path/cacert.pem"
480+
481+
cp -f "$security_cert_file" "$tmp_ca_path"
482+
security_cert_file="$tmp_ca_path/riak-test-cert.pem"
483+
484+
cp -f "$security_key_file" "$tmp_ca_path"
485+
security_key_file="$tmp_ca_path/riak-test-key.pem"
486+
487+
chmod 755 "$tmp_ca_path"
488+
chmod 644 "$tmp_ca_path"/*
489+
pinfo "Using certificates in $tmp_ca_path"
476490
else
477491
errexit 'missing CA directory'
478492
fi

0 commit comments

Comments
 (0)