views:

730

answers:

2

I've recently installed Apache on my FreeBSD machine. All was working fine; telnet via the local machine and http through Firefox on my XP box (connected via my DSL router) were garnering the "It works!" page. Then, I restarted my BSD machine and now neither telnet (through both su and my normal account) nor Firefox are allowed connections--I keep get 403 errors for both. I've checked permissions and gone through the httpd.conf many times but I can't figure this out. My httpd.conf file is as follows:

ServerRoot "/usr/local"

Listen 80

LoadModule authn_file_module libexec/apache22/mod_authn_file.so
LoadModule authn_dbm_module libexec/apache22/mod_authn_dbm.so
LoadModule authn_anon_module libexec/apache22/mod_authn_anon.so
LoadModule authn_default_module libexec/apache22/mod_authn_default.so
LoadModule authn_alias_module libexec/apache22/mod_authn_alias.so
LoadModule authz_host_module libexec/apache22/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache22/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache22/mod_authz_user.so
LoadModule authz_dbm_module libexec/apache22/mod_authz_dbm.so
LoadModule authz_owner_module libexec/apache22/mod_authz_owner.so
LoadModule authz_default_module libexec/apache22/mod_authz_default.so
LoadModule auth_basic_module libexec/apache22/mod_auth_basic.so
LoadModule auth_digest_module libexec/apache22/mod_auth_digest.so
LoadModule file_cache_module libexec/apache22/mod_file_cache.so
LoadModule cache_module libexec/apache22/mod_cache.so
LoadModule disk_cache_module libexec/apache22/mod_disk_cache.so
LoadModule dumpio_module libexec/apache22/mod_dumpio.so
LoadModule include_module libexec/apache22/mod_include.so
LoadModule filter_module libexec/apache22/mod_filter.so
LoadModule charset_lite_module libexec/apache22/mod_charset_lite.so
LoadModule deflate_module libexec/apache22/mod_deflate.so
LoadModule log_config_module libexec/apache22/mod_log_config.so
LoadModule logio_module libexec/apache22/mod_logio.so
LoadModule env_module libexec/apache22/mod_env.so
LoadModule mime_magic_module libexec/apache22/mod_mime_magic.so
LoadModule cern_meta_module libexec/apache22/mod_cern_meta.so
LoadModule expires_module libexec/apache22/mod_expires.so
LoadModule headers_module libexec/apache22/mod_headers.so
LoadModule usertrack_module libexec/apache22/mod_usertrack.so
LoadModule unique_id_module libexec/apache22/mod_unique_id.so
LoadModule setenvif_module libexec/apache22/mod_setenvif.so
LoadModule version_module libexec/apache22/mod_version.so
LoadModule ssl_module libexec/apache22/mod_ssl.so
LoadModule mime_module libexec/apache22/mod_mime.so
LoadModule dav_module libexec/apache22/mod_dav.so
LoadModule status_module libexec/apache22/mod_status.so
LoadModule autoindex_module libexec/apache22/mod_autoindex.so
LoadModule asis_module libexec/apache22/mod_asis.so
LoadModule info_module libexec/apache22/mod_info.so
LoadModule cgi_module libexec/apache22/mod_cgi.so
LoadModule dav_fs_module libexec/apache22/mod_dav_fs.so
LoadModule vhost_alias_module libexec/apache22/mod_vhost_alias.so
LoadModule negotiation_module libexec/apache22/mod_negotiation.so
LoadModule dir_module libexec/apache22/mod_dir.so
LoadModule imagemap_module libexec/apache22/mod_imagemap.so
LoadModule actions_module libexec/apache22/mod_actions.so
LoadModule speling_module libexec/apache22/mod_speling.so
LoadModule userdir_module libexec/apache22/mod_userdir.so
LoadModule alias_module libexec/apache22/mod_alias.so
LoadModule rewrite_module libexec/apache22/mod_rewrite.so

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>

User www
Group www

</IfModule>
</IfModule>

ServerAdmin [email protected]

ServerName 192.168.2.12:80

DocumentRoot /home/prosperity/html

<Directory />
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory /home/prosperity/html>

    Options Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny
    Allow from all

</Directory>

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>

ErrorLog "/var/log/httpd-error.log"

LogLevel warn

<IfModule log_config_module>

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "/var/log/httpd-access.log" combined
</IfModule>

<IfModule alias_module>

    ScriptAlias /cgi-bin/ "/usr/local/www/apache22/cgi-bin/"

</IfModule>

<IfModule cgid_module>

</IfModule>

<Directory "/usr/local/www/apache22/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

DefaultType text/plain

<IfModule mime_module>

    TypesConfig etc/apache22/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

</IfModule>

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

Include etc/apache22/Includes/*.conf

EDIT: Chris asked for some log file data so here it is.

First, httpd-error.log

[Sun Apr 19 22:37:35 2009] [notice] Digest: done
[Sun Apr 19 22:37:36 2009] [notice] Apache/2.2.9 (FreeBSD) mod_ssl/2.2.9 OpenSSL/0.9.8e DAV/2 configured -- resuming normal operations
[Mon Apr 20 00:00:28 2009] [notice] caught SIGTERM, shutting down
[Mon Apr 20 00:01:18 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Mon Apr 20 00:01:19 2009] [notice] Digest: generating secret for digest authentication ...
[Mon Apr 20 00:01:19 2009] [notice] Digest: done
[Mon Apr 20 00:01:20 2009] [notice] Apache/2.2.9 (FreeBSD) mod_ssl/2.2.9 OpenSSL/0.9.8e DAV/2 configured -- resuming normal operations
[Mon Apr 20 00:01:26 2009] [error] [client 192.168.2.10] (13)Permission denied: access to / denied
[Mon Apr 20 00:01:54 2009] [error] [client 192.168.2.12] (13)Permission denied: access to / denied
[Mon Apr 20 00:02:12 2009] [error] [client 192.168.2.12] (13)Permission denied: access to /home/prosperity/html/index.html denied

Second, httpd-access.log:

192.168.2.12 - - [19/Apr/2009:21:31:40 -0400] "GET / " 403 202 "-" "-"
192.168.2.10 - - [19/Apr/2009:21:51:07 -0400] "GET / HTTP/1.1" 403 202 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8 (.NET CLR 3.5.30729)"
192.168.2.12 - - [19/Apr/2009:22:00:29 -0400] "GET / " 403 202 "-" "-"
192.168.2.12 - - [19/Apr/2009:22:00:54 -0400] "GET /home/prosperity/test.html" 403 227 "-" "-"
192.168.2.12 - - [19/Apr/2009:22:01:13 -0400] "GET /home/prosperity/index.html" 403 228 "-" "-"
127.0.0.1 - - [19/Apr/2009:22:07:00 -0400] "GET / HTTP/1.0" 403 202 "-" "-"
192.168.2.12 - - [19/Apr/2009:22:13:12 -0400] "GET /home/prosperity/html/test.html" 403 232 "-" "-"
192.168.2.10 - - [20/Apr/2009:00:01:26 -0400] "GET / HTTP/1.1" 403 202 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8 (.NET CLR 3.5.30729)"
192.168.2.12 - - [20/Apr/2009:00:01:54 -0400] "GET /" 403 202 "-" "-"
192.168.2.12 - - [20/Apr/2009:00:02:12 -0400] "GET /home/prosperity/html/index.html" 403 233 "-" "-"
A: 

Was PF enabled on boot?

You can check /etc/rc.conf for something like:

pf_enable="YES"

If so then it's probably blocking telnet and http incoming connections. You can either add a rule for telnet/apache in /etc/pf.rules or just change the above setting to "NO".

Also are you sure both daemon's were restarted on boot? Depending on how you installed and configured both telnet and Apache they could be missing the correct settings to automatically start on boot.

Again check /etc/rc.conf for something like:

apache_enable="YES"

or

apache22_enable="YES"

As Chris said in the comments, it's hard to guess without knowing more from the logs.

Also double check that you do in fact have an IP address. Hey you never know.

Brian Gianforcaro
My rc.conf file does not have the pf_enable option at all. It does however have apache22_enable="YES and apache22_http_accept_enable="YES" lines.
gvkv
/etc/defaults/rc.conf has pf_enable="NO" so I'll change that. Any idea why it was working before?
gvkv
I just looked at your question again, PF isn't your problem if your getting 403 errors. So don't change anything in /etc/rc.conf .
Brian Gianforcaro
@gvkv: Don't change anything in /etc/defaults/rc.conf, if you want to override any variable in /etc/defaults/rc.conf do so by putting it in /etc/rc.conf.
X-Istence
+1  A: 

It looks like /home/prosperity/html has the wrong permissions from the error log.

It should be readable by group: www and user: www as defined in your http.conf

Brian Gianforcaro
Both /home/prosperity/html has drwxr-xr-x permissions and every file in the html directory has -rwxrw-r-- permissions. If everyone can read, why can't the www user not do so?
gvkv
Does /home/prosperity have the correct permissions?
Brian Gianforcaro
D'oh! Everything's working fine. Thanks Brian!
gvkv