Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit dc65ff8

Browse files
committed
distribution: create sha256sum.txt file when creating binaries to allow validation of checksums.
* update README.md to include instructions on how to verify prebuilt binaries for new releases.
1 parent b0c1c85 commit dc65ff8

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ to validate accounts by email, domain or group.
1616
## Installation
1717

1818
1. Download [Prebuilt Binary](https://github.com/bitly/oauth2_proxy/releases) (current release is `v2.2`) or build with `$ go get github.com/bitly/oauth2_proxy` which will put the binary in `$GOROOT/bin`
19+
Prebuilt binaries can be validated by extracting the file and verifying it against the `sha256sum.txt` checksum file provided for each release starting with version `v2.3`.
20+
```
21+
sha256sum -c sha256sum.txt 2>&1 | grep OK
22+
oauth2_proxy-2.3.linux-amd64: OK
23+
```
1924
2. Select a Provider and Register an OAuth Application with a Provider
2025
3. Configure OAuth2 Proxy using config file, command line options, or environment variables
2126
4. Configure SSL or Deploy behind a SSL endpoint (example provided for Nginx)

dist.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ os=$(go env GOOS)
1313
arch=$(go env GOARCH)
1414
version=$(cat $DIR/version.go | grep "const VERSION" | awk '{print $NF}' | sed 's/"//g')
1515
goversion=$(go version | awk '{print $3}')
16+
sha256sum=()
1617

1718
echo "... running tests"
1819
./test.sh
@@ -25,10 +26,22 @@ for os in windows linux darwin; do
2526
fi
2627
BUILD=$(mktemp -d ${TMPDIR:-/tmp}/oauth2_proxy.XXXXXX)
2728
TARGET="oauth2_proxy-$version.$os-$arch.$goversion"
29+
FILENAME="oauth2_proxy-$version.$os-$arch$EXT"
2830
GOOS=$os GOARCH=$arch CGO_ENABLED=0 \
29-
go build -ldflags="-s -w" -o $BUILD/$TARGET/oauth2_proxy$EXT || exit 1
30-
pushd $BUILD
31-
tar czvf $TARGET.tar.gz $TARGET
31+
go build -ldflags="-s -w" -o $BUILD/$TARGET/$FILENAME || exit 1
32+
pushd $BUILD/$TARGET
33+
sha256sum+=("$(shasum -a 256 $FILENAME || exit 1)")
34+
cd .. && tar czvf $TARGET.tar.gz $TARGET
3235
mv $TARGET.tar.gz $DIR/dist
3336
popd
3437
done
38+
39+
checksum_file="sha256sum.txt"
40+
cd $DIR/dist
41+
if [ -f $checksum_file ]; then
42+
rm $checksum_file
43+
fi
44+
touch $checksum_file
45+
for checksum in "${sha256sum[@]}"; do
46+
echo "$checksum" >> $checksum_file
47+
done

0 commit comments

Comments
 (0)