Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

78 lignes
2.1 KiB

  1. #!/usr/bin/env bash
  2. set -e
  3. #########
  4. # Check #
  5. #########
  6. OUTPUT_DIR=LessPass
  7. if [ -d "$OUTPUT_DIR" ]
  8. then
  9. echo "LessPass directory exists, move ./LessPass folder and re-run lesspass.sh script"
  10. exit 1
  11. fi
  12. docker --version
  13. docker-compose --version
  14. ####################
  15. # Context creation #
  16. ####################
  17. mkdir $OUTPUT_DIR
  18. cd $OUTPUT_DIR
  19. if [ "$#" -eq "2" ]
  20. then
  21. DOMAIN=$1
  22. EMAIL=$2
  23. else
  24. echo "Please enter your domain name (e.g. example.org): "
  25. read DOMAIN
  26. echo
  27. echo "Please enter your email (Used to generate an HTTPS certificate with LetsEncrypt):"
  28. read EMAIL
  29. fi
  30. DATABASE_PASSWORD=$(LC_ALL=C tr -dc A-Za-z0-9_ </dev/urandom | head -c 32)
  31. SECRET_KEY=$(LC_ALL=C tr -dc A-Za-z0-9_ </dev/urandom | head -c 32)
  32. cat >> .env << EOF
  33. ALLOWED_HOSTS=.$DOMAIN
  34. DATABASE_PASSWORD=$DATABASE_PASSWORD
  35. SECRET_KEY=$SECRET_KEY
  36. DOMAIN=$DOMAIN
  37. EMAIL=$EMAIL
  38. EOF
  39. #######################
  40. # Docker compose file #
  41. #######################
  42. curl -s -o docker-compose.yml https://raw.githubusercontent.com/lesspass/lesspass/master/docker-compose.prod.yml
  43. docker-compose pull
  44. docker-compose down
  45. ###############
  46. # LetsEncrypt #
  47. ###############
  48. echo "Create LetsEncrypt certificate..."
  49. mkdir letsencrypt
  50. docker run -it --rm -p 443:443 -p 80:80 -v $PWD/letsencrypt:/etc/letsencrypt/ certbot/certbot certonly --standalone --noninteractive --quiet --email $EMAIL --agree-tos -d $DOMAIN
  51. docker run -it --rm -v $PWD/letsencrypt/live/:/certificates/ lesspass/openssl openssl dhparam -out /certificates/$DOMAIN/dhparam.pem 4096
  52. ############
  53. # LessPass #
  54. ############
  55. curl -s -o update.sh https://raw.githubusercontent.com/lesspass/lesspass/master/scripts/update.sh
  56. chmod u+x update.sh
  57. docker-compose up -d
  58. echo "--------------------------------------------"
  59. echo "Congratulation LessPass Database is running!"
  60. echo "--------------------------------------------"
  61. echo "visit https://$DOMAIN"
  62. echo
  63. echo "## Create super user"
  64. echo "see: https://github.com/lesspass/lesspass#create-super-user"
  65. echo
  66. echo "## Update LessPass"
  67. echo "Just run ./update.sh"
  68. echo "It renews the LestEncrypt certificate and updates LessPass"