Guest User

Untitled

a guest
Jan 21st, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #!/bin/sh
  2. user=$1 # git !
  3. filter=$2 # @$
  4.  
  5. cat /home/git/.ssh/authorized_keys 2>/dev/null | grep "${filter:-@$}"
  6. exit 0
  7.  
  8. ExposeAuthInfo yes
  9. Match User git
  10. AuthorizedKeysCommand /path/to/authorizedkeyscommand git # @$ as default
  11. ForceCommand /path/to/forcecommand git
  12.  
  13. #!/bin/ksh
  14. set -x
  15.  
  16. user=$1 # git
  17.  
  18. if [[ -r ${SSH_USER_AUTH} ]]; then
  19. pubkey="$(cat ${SSH_USER_AUTH} | cut -d' ' -f2-)"
  20. realuser=$(/path/to/authorizedkeyscommand git | grep "${pubkey}" | sed 's/^.* ([^@]*)@$/1/' )
  21. [[ -n ${realuser} ]] && exec ssh -i $HOME/${realuser}_key <final_destination> "${SSH_ORIGINAL_COMMAND:-}"
  22. else
  23. exit 1
  24. fi
Add Comment
Please, Sign In to add comment