myoung34 / docker-github-actions-runner

This will run the new self-hosted github actions runners with docker-in-docker
GNU General Public License v3.0
1.63k stars 386 forks source link

Could not read private key from /dev/fd/63 #369

Open Inveracity opened 3 months ago

Inveracity commented 3 months ago

Heya, while attempting to register my runner with an app private key I ran into the following error message:

Could not read private key from /dev/fd/63

I found that I could work around it by making the following change in app_token.sh

+ PRIVATE_KEY_PATH=$1
rsa256_sign() {
+ openssl dgst -binary -sha256 -sign $PRIVATE_KEY_PATH
- openssl dgst -binary -sha256 -sign <(echo "$1")
}

and then run it

bash app_token.sh /path/to/my.pem

If this is a reasonable change I'll submit a PR

Host info:

myoung34 commented 3 months ago

Good catch, this was missed a long time ago. the current usage is definitely wrong as <() returns a file descriptor and not what was expected. A simple PR should be good enough

however scope the variable:

rsa256_sign() {
 PRIVATE_KEY_PATH=$1
 openssl dgst -binary -sha256 -sign $PRIVATE_KEY_PATH
}

or

rsa256_sign() {
 openssl dgst -binary -sha256 -sign $1
}