You are here
Abhinav Bipnesh - Wed, 2019/09/04 - 15:21
I am using revision control image. There is no authentication for accessing the pages or SVN / Git web views.
I wan to put some level of authentication so that it will ask for username and password. I tried to creating .htpasswd and put below block in svn.conf & git.conf.
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
But it didn't work. Also tried creating /var/www/.htaccess file with above content but it didn't work.
Anythought how to make asking for login & password. Along with cacheing of password disabled.
Forum:
Tags:
It should already require auth to push?!
It should already require authentication to push (via git or SVN). Although perhaps you're hoping to stop read only access without logging in?
If so, the steps you've outlined should work (or at least be really close...), although perhaps it's worth trying to do that within the directory block of the main config file? (i.e. /etc/apache2/sites-available/revisioncontrol.conf)? TBH, I'm not 100% sure that it will work for those serivces as they aren't actually within the doc root, but might be worth a shot? Also, I'll provide some example config below.
The other thing is that Apache needs to be restarted before config changes are applied. That should be as simple as:
If you wish to use .htaccess files, you need to tell Apache to read them. Do that by adding the "AllowOverride All" directive. Again you'll want to restart Apache to apply the config change.
Also, I just noticed that the current config in the directory block, is actually deprecated (although currently still works in it's basic form). There is a note in the Apache docs, that mixing old and newer directives can sometimes cause unexpected results, so you may also want to adjust that too:
Current directory block:
To keep it as is, change that to:
To also read .htaccess files:
To include auth (and read .htaccess):
Hopefully that works?! Please let me know how you go and if you continue to have struggles, I'll boot an instance up and have a look myself...
Add new comment