diff options
| author | 2025-10-22 10:12:07 +0200 | |
|---|---|---|
| committer | 2025-10-22 10:17:59 +0200 | |
| commit | 56f53d5e21e5044041c910f98f5eb2c5fd7fce2b (patch) | |
| tree | 7ed5169ff9bf66bb4a913b0149bf433b39c0e0ee /src/run | |
| parent | 9e946a8a45c23a72d7a55e4ca37360ab84f963cc (diff) | |
- Added also info logging for successful attempts
- merge info and error logs
- Fix log being overwritten with every entry
Diffstat (limited to 'src/run')
| -rwxr-xr-x | src/run | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -8,7 +8,7 @@ set -l currentUser (whoami) set -l matcher (string match -r -g $_GIT_VALIDATION_REGEX -- "$argv") if test (count $matcher) -ne 2 # there should be two groups otherwise something is wrong - echo "$(date -Is): DENY bad_format user=$currentUser ip=$SSH_CONNECTION argv=$argv" &>$LOG + echo "$(date -Is): DENY bad_format user=$currentUser ip=$SSH_CONNECTION argv=$argv" &>$_LOG exit 1 end @@ -22,16 +22,19 @@ set -l repoDir /(string join -n '/' srv repos (string split '/' $repo)) # check repo jail in /srv/repos if not string match -r -q -- "/srv/repos/.*" "(realpath $repoDir)" # something is for sure wrong here - echo "$(date -Is): DENY jail_escape user=$currentUser ip=$SSH_CONNECTION argv=$argv" &>$LOG + echo "$(date -Is): DENY jail_escape user=$currentUser ip=$SSH_CONNECTION argv=$argv" &>>$_LOG exit 2 end # check for permissions if not cat $_REPO_PERMISSIONS_FILE | grep -q -E "^$repoDir:$currentUser\$" # something is for sure wrong here - echo "$(date -Is): DENY no_permissions user=$currentUser ip=$SSH_CONNECTION argv=$argv" &>$LOG + echo "$(date -Is): DENY no_permissions user=$currentUser ip=$SSH_CONNECTION argv=$argv" &>>$_LOG exit 1 end +# info logging +echo "$(date -Is): ALLOW user=$currentUser ip=$SSH_CONNECTION argv=$argv" &>>$_LOG + # execute parsed git command /usr/bin/sudo -u git /usr/bin/git-shell -c "$gitCommand '$repoDir'" |
