revoke.sh 678 B

123456789101112131415161718192021
  1. #!/bin/bash
  2. #git_url_pki="https://git.sdsys.ru/iru/openvpn-pki.git"
  3. #git_dir_pki="openvpn-pki"
  4. JENKINS_MAIL="jenkins.dev@sdsys.ru"
  5. cd /
  6. GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git clone ${git_url_pki}
  7. cd /${git_dir_pki} && git checkout $2
  8. serial=$(stonevpn -a | grep "$1" | awk '{print $1}')
  9. stonevpn -r ${serial}
  10. cd /${git_dir_pki}
  11. echo "Revoke $1" > /tmp/commit.txt
  12. git add -A
  13. git config --global user.email "${JENKINS_MAIL}"
  14. git config --global user.name "Jenkins"
  15. git commit -F /tmp/commit.txt
  16. GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git push origin $2