revoke.sh 770 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}
  7. cd /${git_dir} && git checkout $2
  8. serial=$(stonevpn -a | grep "$1" | awk '{print $1}')
  9. stonevpn -r ${serial}
  10. mv /${git_dir}/open/easy-rsa/client_keys/sds-$1.zip /${git_dir}/open/easy-rsa/client_keys/old-sds-$1.zip
  11. cd /${git_dir}
  12. echo "Revoke $1" > /tmp/commit.txt
  13. git add -A
  14. git config --global user.email "${JENKINS_MAIL}"
  15. git config --global user.name "Jenkins"
  16. git commit -F /tmp/commit.txt
  17. GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git push origin $2