The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reuse_bubble_mitm_certs.sh 1007 B

4 years ago
12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. function die {
  3. echo 1>&2 "${1}"
  4. exit 1
  5. }
  6. CERTS_BACKUP=/home/bubble/mitm_certs
  7. if [[ ! -d ${CERTS_BACKUP} ]] ; then
  8. echo "No mitm_certs backup found, skipping restore"
  9. exit 0
  10. fi
  11. MITM_CERTS=/home/mitmproxy/.mitmproxy
  12. if [[ -d ${MITM_CERTS} ]] ; then
  13. echo "Removing obsolete mitm certs: ${MITM_CERTS}"
  14. rm -rf ${MITM_CERTS} || die "Error removing obsolete mitm certs"
  15. if [[ -d ${MITM_CERTS} ]] ; then
  16. die "Error removing obsolete mitm certs: dir still exists: ${MITM_CERTS}"
  17. fi
  18. fi
  19. mkdir -p ${MITM_CERTS} || die "Error creating mitm certs dir: ${MITM_CERTS}"
  20. chmod 750 ${MITM_CERTS} || die "Error setting permissions on mitm certs dir: ${MITM_CERTS}"
  21. cp -R ${CERTS_BACKUP}/* ${MITM_CERTS}/ || die "Error restoring mitm certs"
  22. chown -R mitmproxy ${MITM_CERTS} || die "Error changing ownership of ${MITM_CERTS}"
  23. chgrp -R root ${MITM_CERTS} || die "Error changing group ownership of ${MITM_CERTS}"
  24. chmod 440 ${MITM_CERTS}/* || die "Error setting permissions on mitm certs files"