feat: switches borg serve restriction to use --restrict-to-repository

This commit is contained in:
Ravinou 2026-01-09 13:48:46 +01:00 committed by Ravinou
commit 29ca7dfeec
2 changed files with 5 additions and 5 deletions

View file

@ -77,7 +77,7 @@ else
fi
## Add ssh public key in authorized_keys with borg restriction for only 1 repository and storage quota
restricted_authkeys="command=\"cd ${pool};borg serve${appendOnlyMode} --restrict-to-path ${pool}/${repositoryName} --storage-quota $2G\",restrict $1"
restricted_authkeys="command=\"cd ${pool};borg serve${appendOnlyMode} --restrict-to-repository ${pool}/${repositoryName} --storage-quota $2G\",restrict $1"
echo "$restricted_authkeys" | tee -a "${authorized_keys}" >/dev/null
## Return the repositoryName

View file

@ -81,24 +81,24 @@ teardown() {
@test "Test createRepo.sh key ED25519 insertion in authorized_keys" {
run bash /test/scripts/createRepo.sh "$SSH_KEY_ED25519" 10 false
expected_line="command=\"cd ${home}/repos;borg serve --restrict-to-path ${home}/repos/${output} --storage-quota 10G\",restrict $SSH_KEY_ED25519"
expected_line="command=\"cd ${home}/repos;borg serve --restrict-to-repository ${home}/repos/${output} --storage-quota 10G\",restrict $SSH_KEY_ED25519"
grep -qF "$expected_line" /tmp/borgwarehouse/.ssh/authorized_keys
}
@test "Test createRepo.sh key ED25519-SK insertion in authorized_keys" {
run bash /test/scripts/createRepo.sh "$SSH_KEY_ED25519_SK" 10 false
expected_line="command=\"cd ${home}/repos;borg serve --restrict-to-path ${home}/repos/${output} --storage-quota 10G\",restrict $SSH_KEY_ED25519_SK"
expected_line="command=\"cd ${home}/repos;borg serve --restrict-to-repository ${home}/repos/${output} --storage-quota 10G\",restrict $SSH_KEY_ED25519_SK"
grep -qF "$expected_line" /tmp/borgwarehouse/.ssh/authorized_keys
}
@test "Test createRepo.sh key RSA insertion in authorized_keys" {
run bash /test/scripts/createRepo.sh "$SSH_KEY_RSA" 10 false
expected_line="command=\"cd ${home}/repos;borg serve --restrict-to-path ${home}/repos/${output} --storage-quota 10G\",restrict $SSH_KEY_RSA"
expected_line="command=\"cd ${home}/repos;borg serve --restrict-to-repository ${home}/repos/${output} --storage-quota 10G\",restrict $SSH_KEY_RSA"
grep -qF "$expected_line" /tmp/borgwarehouse/.ssh/authorized_keys
}
@test "Test createRepo.sh key ED25519 insertion in authorized_keys with append only mode" {
run bash /test/scripts/createRepo.sh "$SSH_KEY_ED25519" 10 true
expected_line="command=\"cd ${home}/repos;borg serve --append-only --restrict-to-path ${home}/repos/${output} --storage-quota 10G\",restrict $SSH_KEY_ED25519"
expected_line="command=\"cd ${home}/repos;borg serve --append-only --restrict-to-repository ${home}/repos/${output} --storage-quota 10G\",restrict $SSH_KEY_ED25519"
grep -qF "$expected_line" /tmp/borgwarehouse/.ssh/authorized_keys
}