Problem with .htaccess and "everyone" group

Baldrick

Joined: 2009-10-27
Posts: 16
Posted: Tue, 2009-10-27 16:37

Hi there,

I am trying to get Gallery 3 working. It looks great, but I’ve run into a bit of a snag.
I have taken the latest code from the development page (gallery-gallery3-d3e73cb.zip)

Installation completes successfully, and I can add an album.
What I’m trying to do is make things accessible to registered users only – denying access to any unauthorized guest.

My plan to do that was to go to the root of the gallery, and deselect all “everyone” permissions there, and leaving all rights checked for “registered users”.

What happens however is that as soon as this is done, a .htaccess file is dropped in the album folder, as well as the thumbnail and resize folder, which contains just this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule (.*) /index.php/file_proxy/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
Order Deny,Allow
Deny from All
</IfModule>

This results in registered users being able to see the album exists – but they are blocked from fetching thumbnail, resize, and full size image, resulting in a page with “crosses” wherever these should have been loaded. In fact, it is blocked for the Admin account as well.
Turning on access for “everyone” again removes this file, and thus fixes the problem.

I searched a bit and I found this thread:

http://gallery.menalto.com/node/91986

However, I have tried removing spaces from directory names, and the problem is the same. I think this person maybe has the same problem I do.

Am I not understanding the approach to rights granting correctly, or is something else amiss?

Thanks in advance for your help, and for developing this great software.

Kind regards,

Baldrick

Login or register to post comments
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 9289
Posted: Tue, 2009-10-27 16:58

Change permissions back so Everybody has view permissions and post or PM me a link to your site.

This really sounds related to this:
https://sourceforge.net/apps/trac/gallery/ticket/812
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

Login or register to post comments
Baldrick

Joined: 2009-10-27
Posts: 16
Posted: Wed, 2009-10-28 00:15

I have sent you a PM with link to my site. Just reposting the rest of the reply here as well, in case it helps others.

I have created 2 test albums, one with spaces in the folder name, and one without. Both contain 1 picture, with no special characters or spaces.
Both are perfectly visible, thumbnail, resized version and full version all work. As soon as I remove access for "Everybody", the .htaccess file is dropped and neither folder can be seen anymore.
Given the fact that I used no spaces in the naming for one of the two and it still didn't work, I wonder if it's the exact same problem you described in the ticket posted above.
Is it possible there are not enough permissions somehow to later modify the dropped .htaccess file meaning authorized users are blocked as well?

Thanks

Login or register to post comments
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 9289
Posted: Wed, 2009-10-28 00:22

Well I was looking at it, but access was cutoff ;)

Please PM me a login.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

Login or register to post comments
Baldrick

Joined: 2009-10-27
Posts: 16
Posted: Wed, 2009-10-28 09:28

Sent! :)

Thanks

Login or register to post comments
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 9289
Posted: Wed, 2009-10-28 12:52

o.k. I'm wondering something here and I never tested this before it was fixed.

Does any directory in the path to your gallery3 install have a space, ~ or '?

Also, since a bug was just fixed last night, try upgrading to the latest experimental version:
http://codex.gallery2.org/Gallery3:Upgrading

Make sure to go to gallery.example.com/index.php/upgrader and to follow the tips about unpacking the code.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

Login or register to post comments
Baldrick

Joined: 2009-10-27
Posts: 16
Posted: Wed, 2009-10-28 13:23

Hi!

No, there are no spaces, tildes or apostrophes anywhere. Just an underscore in the public_html path.
It's like this:

/home/blabla/public_html/gallery and then just the installation below that.

I will do the upgrade right now and get back to you.

*update*

I ran the updater by going to the automatic updater page, it took the core from 14 to version 15. I take it there is no newer code to somehow apply?

Unfortunately the problem remains.

Thanks

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 16325
Posted: Wed, 2009-10-28 13:34
Quote:
it took the core from 14 to version 15.

We are at core version 16.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

Login or register to post comments
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 9289
Posted: Wed, 2009-10-28 13:35

Check your var/logs directory (under your G3 directory) and see if there are any error logs in there.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

Login or register to post comments
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 9289
Posted: Wed, 2009-10-28 13:49

Didn't see Dave's post before :)

Yeah, 15 ain't right. The fix I was referring to above was done last night and the core was bumped to version 16 yesterday morning or the day before.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

Login or register to post comments
Baldrick

Joined: 2009-10-27
Posts: 16
Posted: Wed, 2009-10-28 14:13

Hi,

I replaced the code and am now at core 16 and users/groups 2. The problem remains.

Only info from my logfile from today:

?php defined('SYSPATH') or die('No direct script access.'); ?>

2009-10-28 08:03:41 -06:00 --- error: <pre>(array) Array
(
[language] =&gt; SafeString Object
(
[_raw_string:private] =&gt; Language Preference
[_is_safe_html:protected] =&gt; 1
)

)
</pre>

Thanks

Login or register to post comments
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 9289
Posted: Wed, 2009-10-28 16:34

Any way you could give me SSH or FTP access?
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

Login or register to post comments
Baldrick

Joined: 2009-10-27
Posts: 16
Posted: Wed, 2009-10-28 16:40

Sending you the details now. Can't do SSH but FTP should work.

Login or register to post comments
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 9289
Posted: Wed, 2009-10-28 18:57

Can you find out what version of Apache is running on the server?
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

Login or register to post comments
Baldrick

Joined: 2009-10-27
Posts: 16
Posted: Thu, 2009-10-29 00:12

Apache version 2.2.13 (Unix)
PHP version 5.2.9

Login or register to post comments
Baldrick

Joined: 2009-10-27
Posts: 16
Posted: Mon, 2009-11-02 09:02

Hi,

Anything else you need me to check?

I'd love to get started, the rights issue is the only thing preventing me from implementing Gallery3 at the moment.

Kind regards,

B.

Login or register to post comments
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 9289
Posted: Mon, 2009-11-02 14:59

Could you post a link to phpinfo?

I'd like to get a dev to look at this. For some reason your server works with URL Rewrites, but it doesn't like these rewrite rules. Can I send the login info you've sent me to one of the developers? Do you have access to the error logs for your site? If so, please look at those and see if there are any entries in there.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

Login or register to post comments
Baldrick

Joined: 2009-10-27
Posts: 16
Posted: Mon, 2009-11-02 16:02

Hi,

Sure, feel free to pass on the logon info. I will send you the link to phpinfo in a PM as well.
As for error logs - I checked several (including the php error log) but there are no recent entries in there.

Anything else I can do to help, let me know.

Login or register to post comments
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 9289
Posted: Mon, 2009-11-02 16:15

Have you checked the Apache error and access logs?
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

Login or register to post comments
Baldrick

Joined: 2009-10-27
Posts: 16
Posted: Mon, 2009-11-02 16:42

Whoa, looks like the logs had just been cleaned out when I last checked, it has built up a new list now:

[Mon Nov 02 09:38:38 2009] [warn] RewriteCond: NoCase option for non-regex pattern '-f' is not supported and will be ignored. [Mon Nov 02 09:38:39 2009] [warn] RewriteCond: NoCase option for non-regex pattern '-f' is not supported and will be ignored. [Mon Nov 02 09:38:39 2009] [warn] RewriteCond: NoCase option for non-regex pattern '-f' is not supported and will be ignored. [Mon Nov 02 09:38:39 2009] [warn] RewriteCond: NoCase option for non-regex pattern '-f' is not supported and will be ignored.

I also got one of these with a specific client address in front of it, don't know if it's related:

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

Does that tell you anything?

Cheers

Login or register to post comments
Baldrick

Joined: 2009-10-27
Posts: 16
Posted: Mon, 2009-11-02 16:52

Hmm, I just realized one thing - The server has a PHP FastCGI option that is used by default to reduce overhead as it's a shared box. I just switched that off and reverted to normal PHP and it seems to be working!

I will test a bit more if everything works as intended now, with a new album, and let you know.

Login or register to post comments
Baldrick

Joined: 2009-10-27
Posts: 16
Posted: Mon, 2009-11-02 18:16

It looks like it is ok. The only thing I noticed is that when I add pictures and block "Everyone" access at the top gallery level, the newly added album folder, thumbnail folder, and resize folder don't automatically get a .htaccess file dropped in them, so they can be opened by anyone who knows the path.
If I then explicitly deny permission again on the album itself, the .htaccess file is dropped and it works correctly.
Is this something I can change in the settings?

Thanks for all the help!

Login or register to post comments
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 9289
Posted: Tue, 2009-11-03 18:35

That last behavior you're mentioning shouldn't be that way. I'll have to look into that and see if I can reproduce on my install.

As for the other info about fastcgi and url rewrite not working right on your install. That's good info to check on. I did some searching and it looks like they are suppose to behave correctly, but others had problems with other stuff (not gallery) too.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

Login or register to post comments
Baldrick

Joined: 2009-10-27
Posts: 16
Posted: Tue, 2009-11-03 20:29

Thanks again for all your help, I really appreciate it.

I have one more question, unrelated to the previous.

Some of the items I am uploading are movies. I know only FLV and MP4 are supported for the moment, but the problem is my shared hosting environment does not support FFMPEG.

I don't necessarily need to have these movie clips display within the gallery itself, it would be good enough if the item was visible as an icon that, upon clicking, would allow you to download the item for offline viewing. I had this approach in version 2 as well.
Is there any way to accomplish this in Gallery3?

Thanks

Login or register to post comments
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 9289
Posted: Tue, 2009-11-03 20:47

I have no idea. I don't have any flv or mp4 movies to test with. I think ffmpeg is only used to grab a frame to display as a thumbnail anyway.

I searched for bugs and only found this:
http://sourceforge.net/apps/trac/gallery/ticket/564

Which makes it sound like there is already a default icon for movies if ffmpeg can't create a thumbnail.

If you can post or pm me a link to an flv I can try it on my test server.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

Login or register to post comments
Baldrick

Joined: 2009-10-27
Posts: 16
Posted: Tue, 2009-11-03 21:28

I don't actually have an flv or MP4 yet, but I have some AVI and other files that I would like to have in there. It could be on a default icon that's clickable to initiate download.
What's happening now is that if I add a folder with JPG and AVI in it, the AVI is automatically ignored in the server add process.
This prohibits me from putting them in there.
Is there any way around that?

Thank you!

Login or register to post comments
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 9289
Posted: Tue, 2009-11-03 21:39

Nope, G3 ignores files it doesn't support. You'll need to convert them.

There's been some work on this, but for now you'll need to convert, you might be able to use the stuff rWatcher posted here:
http://gallery.menalto.com/node/91394
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

Login or register to post comments
demogorgon

Joined: 2009-11-03
Posts: 1
Posted: Tue, 2009-11-03 23:33

Just as a note I am having the same exact issues. As soon as i remove "Everyone" from the permissions, I can no longer view thumbs. It definitely has something to do with the rewrite rules.

Login or register to post comments
Baldrick

Joined: 2009-10-27
Posts: 16
Posted: Tue, 2009-11-03 23:43

Hi Demogorgon,

It was fixed for me after I

1) uploaded the latest experimental code
2) changed FastCGI to regular PHP handling on the server
3) removed and re-applied rights so .htaccess was removed and inserted again

Maybe that works for you as well?

Login or register to post comments