aws / aws/aws-ec2-instance-connect-config
"error: AuthorizedKeysCommand /opt/aws/bin/eic_run_authorized_keys ...snip... failed, status 22" error
- Dominant language
- Shell
- Stars
- 88
- Forks
- 39
- PR merge metrics
- No merged PRs in 30d
Description
Because of the combination of shell option `set -e` and `curl -f`, curl returns `22` when HTTP response is 4xx or 5xx, and `eic_curl_authorized_keys` stops immediately, and makes the following error in `/var/log/secure`.
```
error: AuthorizedKeysCommand /opt/aws/bin/eic_run_authorized_keys ...(snip)... failed, status 22
```
### Repro steps
1. Create Amazon Linux 2 instance.
2. Install `ec2-instance-connect-1.1-12.amzn2.noarch`.
3. Logout
4. Login via ssh
5. `grep error /var/log/secure`
```
May 8 19:03:03 ip-172-31-46-138 sshd[2565]: error: AuthorizedKeysCommand /opt/aws/bin/eic_run_authorized_keys ec2-user SHA256:g7uVwGWoozM/n3GrFbjJ8kYyIF7A7UawA3nbRQDxbxk failed, status 22
May 8 19:12:32 ip-172-31-46-138 sshd[2552]: error: AuthorizedKeysCommand /opt/aws/bin/eic_run_authorized_keys ec2-user SHA256:g7uVwGWoozM/n3GrFbjJ8kYyIF7A7UawA3nbRQDxbxk failed, status 22
May 8 19:13:30 ip-172-31-46-138 sshd[2629]: error: AuthorizedKeysCommand /opt/aws/bin/eic_run_authorized_keys ec2-user SHA256:g7uVwGWoozM/n3GrFbjJ8kYyIF7A7UawA3nbRQDxbxk failed, status 22
```
Contributor guide
Research direction
Reproduce the SSH login on Amazon Linux 2 with ec2-instance-connect-1.1-12.amzn2.noarch, then inspect the eic_curl_authorized_keys entry point and its set -e and curl -f handling. Repeat the login and /var/log/secure check; done means the authorized-keys lookup handles HTTP 4xx/5xx without the reported misleading status-22 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, linux, shell
- Domain
- cloud, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100