File tree 2 files changed +37
-0
lines changed
2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 8
8
"path" : {
9
9
"type" : " String" ,
10
10
"description" : " Where to save the downloaded file"
11
+ },
12
+ "check_download" : {
13
+ "type" : " Boolean" ,
14
+ "description" : " Whether to check the integrity of the downloaded file" ,
15
+ "default" : true
11
16
}
12
17
},
13
18
"input_method" : " environment" ,
Original file line number Diff line number Diff line change 11
11
printf ' %s\n' " Downloading: ${PT_source} " >&2
12
12
curl -f -L -o " $PT_path " " $PT_source "
13
13
fi
14
+
15
+ if [[ " $PT_check_download " == " false" ]]; then
16
+ exit 0
17
+ fi
18
+
19
+ if ! which -s gpg ; then
20
+ echo " gpg binary required in path for checking download. Skipping check."
21
+ exit 0
22
+ fi
23
+
24
+ echo " Importing Puppet gpg public key"
25
+ gpg --keyserver hkp://keyserver.ubuntu.com:11371 --recv-key 4528B6CD9E61EF26
26
+ if gpg --list-key --fingerprint 4528B6CD9E61EF26 | grep -q -E " D681 +1ED3 +ADEE +B844 +1AF5 +AA8F +4528 +B6CD +9E61 +EF26" ; then
27
+ echo " gpg public key imported successfully."
28
+ else
29
+ echo " Could not import gpg public key - wrong fingerprint."
30
+ exit 1
31
+ fi
32
+
33
+ sigpath=${PT_path} .asc
34
+ sigsource=${PT_source} .asc
35
+
36
+ echo " Downloading tarball signature from ${sigsource} ..."
37
+ curl -f -L -o " ${sigpath} " " ${sigsource} "
38
+ echo " Downloaded tarball signature to ${sigpath} ."
39
+ echo " Checking tarball signature at ${sigpath} ..."
40
+ if gpg --verify " ${sigpath} " " ${PT_path} " ; then
41
+ echo " Signature verification succeeded."
42
+ else
43
+ echo " Signature verification failed, please re-run the installation."
44
+ exit 1
45
+ fi
You can’t perform that action at this time.
0 commit comments