0
我有一個需要類似於Emulate github service hooks wih curl,但我也在我的webhook中使用一個祕密,它不能正常工作。仿真github鉤與捲曲與祕密
下面是我在做什麼作爲後收到鉤:
#!/bin/bash
while read oldrev newrev refname; do
tmpfile=$(mktemp --suffix=.json)
cat <<EOF> $tmpfile
{
"ref": "${refname}"
}
EOF
sig=$(cat "${tmpfile}" | openssl dgst -sha1 -hmac "${WEBHOOK_SECRET}" | awk '{print "X-Hub-Signature: sha1="$2}')
curl -X POST -H "Content-Type: application/json" -H "${sig}" --data-urlencode "[email protected]${tmpfile}" http://webhook:9000/hooks/r10k
rm -f "${tmpfile}"
done
網絡掛接(與GitHub的作品)抱怨說,簽名是錯誤的。
我在做什麼錯?