Commit 06146b80 by bergquist

build: replace sha1 files with sha256

due to security reasons.
https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html
parent 6b1dd1c7
...@@ -30,7 +30,7 @@ install: ...@@ -30,7 +30,7 @@ install:
build_script: build_script:
- go run build.go build - go run build.go build
- grunt release - grunt release
- go run build.go sha1-dist - go run build.go sha-dist
- cp dist/* . - cp dist/* .
artifacts: artifacts:
......
...@@ -5,7 +5,7 @@ package main ...@@ -5,7 +5,7 @@ package main
import ( import (
"bytes" "bytes"
"crypto/md5" "crypto/md5"
"crypto/sha1" "crypto/sha256"
"encoding/json" "encoding/json"
"flag" "flag"
"fmt" "fmt"
...@@ -105,8 +105,8 @@ func main() { ...@@ -105,8 +105,8 @@ func main() {
grunt(gruntBuildArg("release")...) grunt(gruntBuildArg("release")...)
createDebPackages() createDebPackages()
case "sha1-dist": case "sha-dist":
sha1FilesInDist() shaFilesInDist()
case "latest": case "latest":
makeLatestDistCopies() makeLatestDistCopies()
...@@ -522,14 +522,14 @@ func md5File(file string) error { ...@@ -522,14 +522,14 @@ func md5File(file string) error {
return out.Close() return out.Close()
} }
func sha1FilesInDist() { func shaFilesInDist() {
filepath.Walk("./dist", func(path string, f os.FileInfo, err error) error { filepath.Walk("./dist", func(path string, f os.FileInfo, err error) error {
if path == "./dist" { if path == "./dist" {
return nil return nil
} }
if strings.Contains(path, ".sha1") == false { if strings.Contains(path, ".sha256") == false {
err := sha1File(path) err := shaFile(path)
if err != nil { if err != nil {
log.Printf("Failed to create sha file. error: %v\n", err) log.Printf("Failed to create sha file. error: %v\n", err)
} }
...@@ -538,20 +538,20 @@ func sha1FilesInDist() { ...@@ -538,20 +538,20 @@ func sha1FilesInDist() {
}) })
} }
func sha1File(file string) error { func shaFile(file string) error {
fd, err := os.Open(file) fd, err := os.Open(file)
if err != nil { if err != nil {
return err return err
} }
defer fd.Close() defer fd.Close()
h := sha1.New() h := sha256.New()
_, err = io.Copy(h, fd) _, err = io.Copy(h, fd)
if err != nil { if err != nil {
return err return err
} }
out, err := os.Create(file + ".sha1") out, err := os.Create(file + ".sha256")
if err != nil { if err != nil {
return err return err
} }
......
...@@ -41,7 +41,7 @@ deployment: ...@@ -41,7 +41,7 @@ deployment:
commands: commands:
- ./scripts/build/deploy.sh - ./scripts/build/deploy.sh
- ./scripts/build/sign_packages.sh - ./scripts/build/sign_packages.sh
- go run build.go sha1-dist - go run build.go sha-dist
- aws s3 sync ./dist s3://$BUCKET_NAME/master - aws s3 sync ./dist s3://$BUCKET_NAME/master
- ./scripts/trigger_windows_build.sh ${APPVEYOR_TOKEN} ${CIRCLE_SHA1} master - ./scripts/trigger_windows_build.sh ${APPVEYOR_TOKEN} ${CIRCLE_SHA1} master
- ./scripts/trigger_docker_build.sh ${TRIGGER_GRAFANA_PACKER_CIRCLECI_TOKEN} - ./scripts/trigger_docker_build.sh ${TRIGGER_GRAFANA_PACKER_CIRCLECI_TOKEN}
...@@ -50,7 +50,7 @@ deployment: ...@@ -50,7 +50,7 @@ deployment:
commands: commands:
- ./scripts/build/deploy.sh - ./scripts/build/deploy.sh
- ./scripts/build/sign_packages.sh - ./scripts/build/sign_packages.sh
- go run build.go sha1-dist - go run build.go sha-dist
- aws s3 sync ./dist s3://$BUCKET_NAME/release - aws s3 sync ./dist s3://$BUCKET_NAME/release
- ./scripts/trigger_windows_build.sh ${APPVEYOR_TOKEN} ${CIRCLE_SHA1} release - ./scripts/trigger_windows_build.sh ${APPVEYOR_TOKEN} ${CIRCLE_SHA1} release
- ./scripts/trigger_docker_build.sh ${TRIGGER_GRAFANA_PACKER_CIRCLECI_TOKEN} ${CIRCLE_TAG} - ./scripts/trigger_docker_build.sh ${TRIGGER_GRAFANA_PACKER_CIRCLECI_TOKEN} ${CIRCLE_TAG}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment