Created
February 13, 2017 11:10
-
-
Save matthewberryman/095e4aa8c8c3260c028ef6d1351d7f4d to your computer and use it in GitHub Desktop.
config file for adding basic auth to an elastic beanstalk nginx config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| files: | |
| /etc/nginx/.htpasswd: | |
| mode: "000644" | |
| owner: root | |
| group: root | |
| content: | | |
| username:passwd_hash | |
| # use httpasswd -c -b password_file desired_username desired_password | |
| # and copy and paste the line from that in to username:password_hash | |
| /tmp/deployment/nginx_auth.sh: | |
| mode: "000755" | |
| content: | | |
| sed -i 's/$proxy_add_x_forwarded_for;/$proxy_add_x_forwarded_for;\n auth_basic "Restricted";\n auth_basic_user_file \/etc\/nginx\/.htpasswd;\n/' "/tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf" | |
| sudo cp /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf | |
| sudo /sbin/service nginx restart | |
| exit 0 | |
| container_commands: | |
| 01nginx_auth: | |
| command: "sudo /tmp/deployment/nginx_auth.sh" |
2 years later — @mike623 it won't pass health check since the entry point is already protected.
HAs anyone an working update for this script? I cant make it work for an python 3.7 instance :/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi, it is good script, but seem it not pass for heath check?