]> Git Repo - VerusCoin.git/blame - qa/zcash/check-security-hardening.sh
Auto merge of #1888 - mvrilo:busybox-sha256sum, r=daira
[VerusCoin.git] / qa / zcash / check-security-hardening.sh
CommitLineData
1327d191
TH
1#!/bin/bash
2
3set -e
4
5REPOROOT="$(readlink -f "$(dirname "$0")"/../../)"
6
56734f4b
TH
7function test_rpath_runpath {
8 if "${REPOROOT}/qa/zcash/checksec.sh" --file "$1" | grep -q "No RPATH.*No RUNPATH"; then
9 echo PASS: "$1" has no RPATH or RUNPATH.
1327d191
TH
10 return 0
11 else
56734f4b 12 echo FAIL: "$1" has an RPATH or a RUNPATH.
1327d191
TH
13 "${REPOROOT}/qa/zcash/checksec.sh" --file "$1"
14 return 1
15 fi
16}
17
18function test_fortify_source {
19 if { "${REPOROOT}/qa/zcash/checksec.sh" --fortify-file "$1" | grep -q "FORTIFY_SOURCE support available.*Yes"; } &&
20 { "${REPOROOT}/qa/zcash/checksec.sh" --fortify-file "$1" | grep -q "Binary compiled with FORTIFY_SOURCE support.*Yes"; }; then
21 echo PASS: "$1" has FORTIFY_SOURCE.
22 return 0
23 else
24 echo FAIL: "$1" is missing FORTIFY_SOURCE.
25 return 1
26 fi
27}
28
56734f4b
TH
29# PIE, RELRO, Canary, and NX are tested by make check-security.
30make -C "$REPOROOT/src" check-security
31
32test_rpath_runpath "${REPOROOT}/src/zcashd"
33test_rpath_runpath "${REPOROOT}/src/zcash-cli"
34test_rpath_runpath "${REPOROOT}/src/zcash-gtest"
5d985da5 35test_rpath_runpath "${REPOROOT}/src/zcash-tx"
56734f4b
TH
36test_rpath_runpath "${REPOROOT}/src/test/test_bitcoin"
37test_rpath_runpath "${REPOROOT}/src/zcash/GenerateParams"
1327d191
TH
38
39# NOTE: checksec.sh does not reliably determine whether FORTIFY_SOURCE is
40# enabled for the entire binary. See issue #915.
41test_fortify_source "${REPOROOT}/src/zcashd"
42test_fortify_source "${REPOROOT}/src/zcash-cli"
43test_fortify_source "${REPOROOT}/src/zcash-gtest"
5d985da5 44test_fortify_source "${REPOROOT}/src/zcash-tx"
56734f4b
TH
45test_fortify_source "${REPOROOT}/src/test/test_bitcoin"
46test_fortify_source "${REPOROOT}/src/zcash/GenerateParams"
This page took 0.037249 seconds and 4 git commands to generate.