keygen.sh 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. git_url_pki="ssh://git@git.sdsys.ru:8022/iru/openvpn-pki.git"
  3. git_url_ovpn="ssh://git@git.sdsys.ru:8022/iru/openvpn.git"
  4. git_dir_pki="openvpn-pki"
  5. git_dir_ovpn="openvpn"
  6. JENKINS_MAIL="jenkins.dev@sdsys.ru"
  7. cd /
  8. GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git clone ${git_url_pki}
  9. cd /${git_dir_pki} && git checkout $2
  10. GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git clone ${git_url_ovpn}
  11. cd /${git_dir_ovpn} && git checkout $2
  12. stonevpn -f $1 -n "$1" -z
  13. echo "Generate new key and cert for $1" > /tmp/commit.txt
  14. cd ${git_dir_pki}
  15. git add -A
  16. git config --global user.email "${JENKINS_MAIL}"
  17. git config --global user.name "Jenkins"
  18. git commit -F /tmp/commit.txt
  19. GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git push origin $2
  20. #cd ${git_dir_ovpn}
  21. #git add -A
  22. #git config --global user.email "${JENKINS_MAIL}"
  23. #git config --global user.name "Jenkins"
  24. #git commit -F /tmp/commit.txt
  25. #GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git push origin master