mxschmitt / action-tmate

Debug your GitHub Actions via SSH by using tmate to get access to the runner system itself.
https://mxschmitt.github.io/action-tmate/
MIT License
2.95k stars 289 forks source link

[BUG] overwrites the authorized_keys file in self-hosted gh runner #177

Open yatharthranjan opened 1 year ago

yatharthranjan commented 1 year ago

Hi,

We are using a self-hosted GH runner and seems like we lost SSH access to our instance because this action overwrites the authorized_keys files when limit-access-to-actor set to true. I think it is because of this line https://github.com/mxschmitt/action-tmate/blob/a283f9441d2d96eb62436dc46d7014f5d357ac22/src/index.js#L147

This might be fine on GH hosted runners as they are ephermeral, but for self-hosted runner we have a single instance which is re-used across multiple runs. For this we need SSH access to configure and administer the instance and overwriting SSH keys is not useful. For now we have changed to a new user specific for running the GH runner application so it does not interfere with our primary user account.

I think this should be updated to append to the authorized_keys file instead of replacing it. So any existing keys will also work. Thanks.