Skip to content

Attempt a secure connection to an InCommon SSL site #6

Merged
9 commits merged into from Aug 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
@@ -0,0 +1,7 @@
bin/build.sh
bin/destroy.sh
bin/install.sh
bin/rebuild.sh
bin/rerun.sh
bin/run.sh
bin/test.sh
41 changes: 41 additions & 0 deletions BINSCRIPTS.md
@@ -0,0 +1,41 @@
# util

This repository is intended to be downloaded into a container repository during development for convenience purposes. Since the major mechanisms of developing to the Docker container construction lifecycle are identical across container images, this repository allows for consistency and additional ease of use across all container images.

## Install

If you are reading this file in BINSCRIPTS.md, your container project is likely to be util-enabled.

To use these scripts yourself, issue this command:

```
curl "https://github.internet2.edu/raw/docker/util/master/bin/install.sh?token=AAAAEddkrL9MeeA6VWcNn_PgV30r4lD1ks5XogeiwA%3D%3D" | bash
```

### common.bash

The installation process will create a common.bash file. This file should be the central, canonical authority for management of environment variables. While a subprocess may override them, the files in common.bash should be treated as authoritative defaults. Processes (e.g. `docker build`, `bats`, inside `Jenkinsfile`) can read this file and process the results therein.

You should edit this file to change the image name, and add any other helpful environment variables.

### Jenkinsfile

This will also install a Jenkinsfile to your repository, if it doesn't have one. This will ensure that your Jenkins pipeline can leverage these scripts in the way intended. Ensuring the commands that you issue on your laptop match the commands issued by the build pipeline is critical to ensure predictable, reliable results.

## Use


### Building

#### build.sh
`bin/build.sh `
#### destroy.sh
#### rebuild.sh

### Running
### rerun.sh
### run.sh


### Testing
#### test.sh
7 changes: 6 additions & 1 deletion Dockerfile
Expand Up @@ -15,10 +15,15 @@ LABEL Build docker build --rm --tag $maintainer/$imagename .

# Install base deps
RUN yum -y install epel-release && yum -y update && yum clean all
RUN yum -y install --setopt=tsflags=nodocs epel-release && \
RUN yum -y install --setopt=tsflags=nodocs epel-release && \
yum -y install net-tools wget curl tar unzip mlocate logrotate strace telnet man unzip vim wget rsyslog cron \
yum -y update && yum clean all

# Install Trusted Certificates
RUN update-ca-trust force-enable
ADD ./cert/InCommon.crt /etc/pki/ca-trust/source/anchors/
RUN update-ca-trust extract

# Set default environment variables.
ENV HOME /root

Expand Down
91 changes: 91 additions & 0 deletions cert/InCommon.crt
@@ -0,0 +1,91 @@
-----BEGIN CERTIFICATE-----
MIIF+TCCA+GgAwIBAgIQRyDQ+oVGGn4XoWQCkYRjdDANBgkqhkiG9w0BAQwFADCB
iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl
cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV
BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTQx
MDA2MDAwMDAwWhcNMjQxMDA1MjM1OTU5WjB2MQswCQYDVQQGEwJVUzELMAkGA1UE
CBMCTUkxEjAQBgNVBAcTCUFubiBBcmJvcjESMBAGA1UEChMJSW50ZXJuZXQyMREw
DwYDVQQLEwhJbkNvbW1vbjEfMB0GA1UEAxMWSW5Db21tb24gUlNBIFNlcnZlciBD
QTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJwb8bsvf2MYFVFRVA+e
xU5NEFj6MJsXKZDmMwysE1N8VJG06thum4ltuzM+j9INpun5uukNDBqeso7JcC7v
HgV9lestjaKpTbOc5/MZNrun8XzmCB5hJ0R6lvSoNNviQsil2zfVtefkQnI/tBPP
iwckRR6MkYNGuQmm/BijBgLsNI0yZpUn6uGX6Ns1oytW61fo8BBZ321wDGZq0GTl
qKOYMa0dYtX6kuOaQ80tNfvZnjNbRX3EhigsZhLI2w8ZMA0/6fDqSl5AB8f2IHpT
eIFken5FahZv9JNYyWL7KSd9oX8hzudPR9aKVuDjZvjs3YncJowZaDuNi+L7RyML
fzcCAwEAAaOCAW4wggFqMB8GA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YJKoZIhvcN
AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH
YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC
Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX
c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a
mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
-----END CERTIFICATE-----
3 changes: 1 addition & 2 deletions cleanup_and_stop.sh
Expand Up @@ -3,7 +3,6 @@
source common.sh .

echo "Cleaning up Docker image($maintainer/$imagename)"
docker rmi $maintainer/$imagename >> /dev/null
docker rmi -f $maintainer/$imagename >> /dev/null

exit 0

2 changes: 2 additions & 0 deletions common.bash
@@ -0,0 +1,2 @@
maintainer="tier"
imagename="centos7base"
12 changes: 8 additions & 4 deletions tests/base.bats
@@ -1,6 +1,10 @@
#!/usr/bin/env bats

@test "addition using bc" {
result="$(echo 2+2 | bc)"
[ "$result" -eq 4 ]
}
load ../common

@test "curl should connect to InCommon cert chain site successfully" {
run docker run -i $maintainer/$imagename curl -o /dev/null --silent --head --write-out '%{http_code}\n' https://github.internet2.edu/
echo ${output}
[ "$status" -eq 0 ]
[[ ${output} == *"302"* || ${output} == *"200"* ]]
}