SHARE
TWEET

Untitled

a guest Jun 9th, 2019 23 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # Internal API or Events
  4. # Docs: https://webinoly.com/en/documentation/internal-api-events/
  5.  
  6. # Description: Execute actions at certain points or events, for example at the end of the "stack" command each time is executed
  7. # or after Nginx is installed. Just rename this file to "api-events" and check for the complete list of status codes in the documentation.
  8.  
  9. # Just put all your code inside this function:
  10. api-events_catch_status() {
  11.         echo "${blu}API Status: $1 ${end}"
  12. #--- adding cloudflare
  13. if [[ -n $cf && -a /etc/nginx/sites-available/$domain ]]; then
  14.   if grep -q cloudflare.conf /etc/nginx/sites-available/$domain; then
  15.         echo "Cloudflare already installed!"
  16. else
  17. echo "Installing cloudflare"
  18. cat >/etc/nginx/common/cloudflare.conf <<EOF
  19. # CloudFlare IP addresses
  20. # > IPv4
  21. set_real_ip_from 103.21.244.0/22;
  22. set_real_ip_from 103.22.200.0/22;
  23. set_real_ip_from 103.31.4.0/22;
  24. set_real_ip_from 104.16.0.0/12;
  25. set_real_ip_from 108.162.192.0/18;
  26. set_real_ip_from 131.0.72.0/22;
  27. set_real_ip_from 141.101.64.0/18;
  28. set_real_ip_from 162.158.0.0/15;
  29. set_real_ip_from 172.64.0.0/13;
  30. set_real_ip_from 173.245.48.0/20;
  31. set_real_ip_from 188.114.96.0/20;
  32. set_real_ip_from 190.93.240.0/20;
  33. set_real_ip_from 197.234.240.0/22;
  34. set_real_ip_from 198.41.128.0/17;
  35. # > IPv6
  36. set_real_ip_from 2400:cb00::/32;
  37. set_real_ip_from 2405:8100::/32;
  38. set_real_ip_from 2405:b500::/32;
  39. set_real_ip_from 2606:4700::/32;
  40. set_real_ip_from 2803:f800::/32;
  41. set_real_ip_from 2c0f:f248::/32;
  42. set_real_ip_from 2a06:98c0::/29;
  43. real_ip_header CF-Connecting-IP;
  44. EOF
  45.  
  46. sed -i '/\.*-nginx.conf/a \        include common/cloudflare.conf' /etc/nginx/sites-available/$domain
  47.  
  48. fi
  49. fi
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top