Forums / Setup & design / httpd.conf and securing website

httpd.conf and securing website

Author Message

Heiner Wurbs

Sunday 20 August 2006 10:26:52 am

Hi !
I want to secure complete an eZ publish installation with a httpd password:

    	AuthType Basic 
    	AuthName "eZ publish installation" 
    
    	AuthUserFile /usr/local/apache/passwords
    	Require valid-user 

But it doesnt work :( it displays the content without the images, but I can navigate through the website !
Any help ?
Heiner

Claudia Kosny

Sunday 20 August 2006 1:57:06 pm

Hello Heiner,

your .htaccess file works fine for me.
So I would try the following:
Make sure that you apache reads the file at all.Easiest way to do that is to insert an error in the file and load a webpage that should be protected by the .htaccess. If you get an 500 - server error, your webserver reads the file just fine, if not, check your httpd.conf.
Also check whether your httpd.conf file permits the usage of .htaccess files, especially the authentication.
Make sure that apache has access to the password file, maybe the path is not accessible (especially if you use public webhosting). Although in this case you should get a login prompt but should not be able to login at all...

Greetings from Luxembourg

Claudia

Heiner Wurbs

Monday 21 August 2006 12:52:06 am

Hi Claudia,

thanks for your reply! Nice, that it works with you, so there is only a small thing missing :) It do not work on my vhost. I can modify the complete httpd.conf and the vhosts, so I post the VirtualHost configuration, maybe you will see the error. The Login prompt is displayed, but if I cancel it three times, I can see the content delivered by index.php without any images and styles. Something with the rewrite module?

<VirtualHost 111.222.333.444:80>

    ServerName myserver.com
    ServerAlias myserver.com

    DocumentRoot /srv/www/htdocs/web20/html

    <Directory /srv/www/htdocs/web20>
        Options FollowSymLinks
        AllowOverride None

        AuthType Basic
        AuthName "eZ publish installation"

        AuthUserFile /usr/local/apache/passwords
        Require valid-user
    </Directory>

    php_admin_flag safe_mode Off
    php_admin_value register_globals    0
    php_value magic_quotes_gpc  0
        php_value magic_quotes_runtime  0
        php_value allow_call_time_pass_reference 0

    php_admin_value memory_limit 90M

    DirectoryIndex index.php

    <IfModule mod_rewrite.c>
        RewriteEngine On
        Rewriterule ^/var/storage/.* - [L]
        Rewriterule ^/var/[^/]+/storage/.* - [L]
        RewriteRule ^/var/cache/texttoimage/.* - [L]
        RewriteRule ^/var/[^/]+/cache/texttoimage/.* - [L]
        Rewriterule ^/design/[^/]+/(stylesheets|images|javascript)/.* - [L]
        Rewriterule ^/share/icons/.* - [L]
        Rewriterule ^/extension/[^/]+/design/[^/]+/(stylesheets|images|javascripts?)/.* - [L]
        Rewriterule ^/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
        RewriteRule ^/packages/styles/.+/thumbnail/.* - [L]
        RewriteRule ^/favicon\.ico - [L]
        RewriteRule ^/robots\.txt - [L]
        # Uncomment the following lines when using popup style debug.
        # RewriteRule ^/var/cache/debug\.html.* - [L]
        # RewriteRule ^/var/[^/]+/cache/debug\.html.* - [L]
        RewriteRule .* /index.php
    </IfModule>

    CustomLog /srv/www/htdocs/web20/log/access_log confixx2
</VirtualHost>

Thanks !
Heiner

Claudia Kosny

Monday 21 August 2006 2:51:02 am

Hello Heiner,

The only thing I can say (again) that it works well for me (on a windows machine)... The only way I could kind of recreate your problem is to set the directory in the part where you set the authentication to the 'design' or 'var' directory which you obviously have not done.
Unfortunately I don't know much about virtual hosts, so here just some ideas on how to pinpoint he problem:
It looks like the var and design directories are protected by authentication whereas the base directory for EZ is not. To confirm this I would try to fetch e.g. the robots.txt (which should work without problems) and some file in the design or var directory (where you should be prompted for login).
If that works as expected, try whether the rewrite rules are to blame, first by just taking them out totally. The startpage of your EZ-website should still work fine. Can you see the pictures and styles now? If yes, enable the rewrite rules again and check your rewrite and access log, maybe you can see some information there. If you still can't see the styles and pics and are still prompted for login, I would maybe try to set the directory for the authentication directly in the document root, not one level higher (although both versions were working for me)

Good luck

Claudia

Heiner Wurbs

Monday 21 August 2006 3:48:28 am

Hi Claudia,
thanks for that hints. I made that tests, and it turned out, that the RewriteEngine is the problem. At the moment I have no idea how to solve that. It could be, that this authentication and the rewrite_mod do not work together.

Greetings
Heiner

eZ debug

Timing: Jan 31 2025 06:18:09
Script start
Timing: Jan 31 2025 06:18:09
Module start 'content'
Timing: Jan 31 2025 06:18:09
Module end 'content'
Timing: Jan 31 2025 06:18:09
Script end

Main resources:

Total runtime0.3006 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0078 587.9453180.8359
Module start 'content' 0.00780.0075 768.781397.8828
Module end 'content' 0.01520.2853 866.6641526.5547
Script end 0.3005  1,393.2188 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00361.1904200.0002
Check MTime0.00140.4645200.0001
Mysql Total
Database connection0.00090.303110.0009
Mysqli_queries0.252283.91731410.0018
Looping result0.00130.44581390.0000
Template Total0.284994.810.2849
Template load0.00100.317010.0010
Template processing0.283994.452610.2839
Override
Cache load0.00060.210610.0006
Sytem overhead
Fetch class attribute can translate value0.00080.258210.0008
XML
Image XML parsing0.00030.106510.0003
General
dbfile0.00682.2518200.0003
String conversion0.00000.002030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs