diff --git a/.forgejo/workflows/validate-keys.yaml b/.forgejo/workflows/validate-keys.yaml index 27e6feb..8cf75f2 100644 --- a/.forgejo/workflows/validate-keys.yaml +++ b/.forgejo/workflows/validate-keys.yaml @@ -12,7 +12,7 @@ jobs: image: 'code.forgejo.org/oci/ci:1' steps: - uses: actions/checkout@v4 - - run: for i in *.pub; do ./check_key.sh $i; done + - run: for i in *.pub; do ssh-keygen -l -f $i; done - run: | echo assembeling authorized keys && cat *.pub > authorized_keys diff --git a/byte.pub b/byte.pub index 057ced8..a54982d 100644 --- a/byte.pub +++ b/byte.pub @@ -1 +1,2 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDWcYvzMXydV3n3S5DfT5C0TGQROKC2OUr/WLo+ohqZ7ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICYfR9R1unNcDxCiS9lIYG1xEgZHF9/1zHrOn/Gn9tqB +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDWcYvzMXydV3n3S5DfT5C0TGQROKC2OUr/WLo+ohqZ7 +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICYfR9R1unNcDxCiS9lIYG1xEgZHF9/1zHrOn/Gn9tqB diff --git a/check_key.sh b/check_key.sh deleted file mode 100755 index a963a68..0000000 --- a/check_key.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -# Input file containing the SSH public keys -key_file=$1 - -# Read the file line by line -while IFS= read -r line; do - # Skip empty lines - if [ -z "$line" ]; then - continue - fi - - # Trim leading/trailing whitespace (preserving the key and comment structure) - trimmed_line=$(echo "$line" | xargs) - - # Validate the SSH key format: - # Starts with ssh-, followed by base64-encoded data, and an optional comment - echo $key_file - if ! echo "$trimmed_line" | grep -Eq '^ssh-(rsa|ed25519|dss|ecdsa) [A-Za-z0-9+/=]+ ?.*$'; then - echo "Invalid key format: $line" - exit 1 - fi - - # Ensure there is only one key on the line: a valid key should only have one space separating key data from the comment - space_count=$(echo "$trimmed_line" | grep -o ' ' | wc -l) - if [ "$space_count" -gt 2 ]; then - echo "Invalid: Multiple keys found on the same line" - exit 1 - fi - -done < "$key_file" - -echo "All keys are valid and correctly formatted."