Linux-Based Community / Regional
1764019 Members
3026 Online
108921 Solutions
New Discussion юеВ

Apache startup failed (points!)

 
Christian Deutsch_1
Esteemed Contributor

Re: Apache startup failed (points!)

Wow Chhaya,

That brings me forward! Thank you so much!

So far I identified a problem with a file that I added:

/etc/httpd/conf.d/ssl.conf

Into this file I put:

SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key

This is the cause of the fail.

In an older version of httpd (httpd-2.2.3-19.el5), this worked fine.

Any idea what is different in version httpd-2.2.17-1.fc13.1.x86_64 such that I get this error when I have these values in ssl.conf?

/usr/sbin/httpd -t
Syntax error on line 1 of /etc/httpd/conf.d/ssl.conf:
Invalid command 'SSLCertificateFile', perhaps misspelled or defined by a module not included in the server configuration

Thanks for further help if possible. Of course more points will come :)

Christian
Yeshua loves you!
Goran┬аKoruga
Honored Contributor

Re: Apache startup failed (points!)

Dear Christian.

Are you sure you have "mod_ssl" module loaded? Verify with:

apache2ctl -M

The directive "SSLCertificateFile" is still valid for this module.
Christian Deutsch_1
Esteemed Contributor

Re: Apache startup failed (points!)

Thanks Goran,

I am making some more progress now!

So now I installed:

mod_ssl-2.2.17-1.fc13.1.x86_64

/usr/sbin/httpd -t shows:

Syntax OK

But:

/usr/sbin/apachectl -M

returns no text and error code 1

And:

service httpd --full-restart
Stopping httpd: [ OK ]
Starting httpd: [FAILED]

Some more helpful ideas? (I could not find apache2ctl so I tried /usr/sbin/apachectl instead).

Thanks, Christian

Yeshua loves you!
Chhaya_Z
Valued Contributor

Re: Apache startup failed (points!)

Is SElinux Enabled?
Regards,
Chhaya

I am an HP employee.
Was this post useful? - You may click the KUDOS! star to say thank you.
Chhaya_Z
Valued Contributor

Re: Apache startup failed (points!)

Christian,

Please check the messages file for any errors while starting the httpd service

#tailf /var/log/messages

Regards,
Chhaya

I am an HP employee.
Was this post useful? - You may click the KUDOS! star to say thank you.
Christian Deutsch_1
Esteemed Contributor

Re: Apache startup failed (points!)

Wow Chhaya!

Great work!

Now `/usr/sbin/apachectl -M` shows me the modules being loaded.

And `service httpd --full-restart` started httpd ok.

I changed SELinux Default and Current Enforcing Mode to Permissive. I was not aware that in Fedora 13 it seems that SELinux is enabled by default.

Now apache is running, let me see if everything else works as expected...

Thanks, Christian
Yeshua loves you!
Chhaya_Z
Valued Contributor

Re: Apache startup failed (points!)

Christian,

If you want to get Apache working when SElinux is enabled then you have to set a boolean.

you can try the below step

#setsebool ├в P httpd_disable_trans 1
Now restart the service and it should work fine.

I am glad that its working. It was my pleasure assisting you :)

Have a great day ahead.
Regards,
Chhaya

I am an HP employee.
Was this post useful? - You may click the KUDOS! star to say thank you.
Chhaya_Z
Valued Contributor

Re: Apache startup failed (points!)

In my previous response plz ignore those special characters in the command. It has to be as below

#setsebool -P httpd_disable_trans 1
Regards,
Chhaya

I am an HP employee.
Was this post useful? - You may click the KUDOS! star to say thank you.
Christian Deutsch_1
Esteemed Contributor

Re: Apache startup failed (points!)

Chhaya,

I found these interesting messages in /var/log/messages:

Dec 7 14:06:51 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "getattr" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 6bf2a6f9-223c-41e9-9921-1fe975979551
Dec 7 14:07:23 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "getattr" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 6bf2a6f9-223c-41e9-9921-1fe975979551
Dec 7 14:18:21 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "getattr" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 6bf2a6f9-223c-41e9-9921-1fe975979551
Dec 7 14:24:22 smarty dbus: avc: received setenforce notice (enforcing=0)
Dec 7 14:24:22 smarty dbus: avc: received setenforce notice (enforcing=0)
Dec 7 14:24:22 smarty dbus: Can't send to audit system: USER_AVC avc: received setenforce notice (enforcing=0)#012: exe="?" sauid=81 hostname=? addr=? terminal=?
Dec 7 14:27:36 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "getattr" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 6bf2a6f9-223c-41e9-9921-1fe975979551
Dec 7 14:27:51 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "read" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 7dc6822e-3ea6-4a3d-8afe-3e93ba167dc5
Dec 7 14:27:51 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "read" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 7dc6822e-3ea6-4a3d-8afe-3e93ba167dc5
Dec 7 15:32:37 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "getattr" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 6bf2a6f9-223c-41e9-9921-1fe975979551
Dec 7 15:32:37 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "read" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 7dc6822e-3ea6-4a3d-8afe-3e93ba167dc5
Dec 7 15:32:37 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "read" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 7dc6822e-3ea6-4a3d-8afe-3e93ba167dc5
Dec 7 15:35:56 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "getattr" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 6bf2a6f9-223c-41e9-9921-1fe975979551
Dec 7 15:35:56 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "read" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 7dc6822e-3ea6-4a3d-8afe-3e93ba167dc5
Dec 7 15:35:56 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "read" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 7dc6822e-3ea6-4a3d-8afe-3e93ba167dc5
Dec 7 16:34:10 smarty dbus: avc: received setenforce notice (enforcing=1)
Dec 7 16:34:10 smarty dbus: avc: received setenforce notice (enforcing=1)
Dec 7 16:34:10 smarty dbus: Can't send to audit system: USER_AVC avc: received setenforce notice (enforcing=1)#012: exe="?" sauid=81 hostname=? addr=? terminal=?
Dec 7 16:34:11 smarty dbus: [system] Reloaded configuration
Dec 7 16:35:37 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "getattr" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 6bf2a6f9-223c-41e9-9921-1fe975979551
Dec 7 16:36:06 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "getattr" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 6bf2a6f9-223c-41e9-9921-1fe975979551
Dec 7 16:38:10 smarty dbus: avc: received setenforce notice (enforcing=0)
Dec 7 16:38:10 smarty dbus: avc: received setenforce notice (enforcing=0)
Dec 7 16:38:10 smarty dbus: Can't send to audit system: USER_AVC avc: received setenforce notice (enforcing=0)#012: exe="?" sauid=81 hostname=? addr=? terminal=?
Dec 7 16:38:26 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "getattr" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 6bf2a6f9-223c-41e9-9921-1fe975979551
Dec 7 16:38:26 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "read" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 7dc6822e-3ea6-4a3d-8afe-3e93ba167dc5
Dec 7 16:38:26 smarty setroubleshoot: SELinux is preventing /usr/sbin/httpd "read" access to /etc/pki/tls/private/localhost.key. For complete SELinux messages. run sealert -l 7dc6822e-3ea6-4a3d-8afe-3e93ba167dc5

When I ran `setsebool -P httpd_disable_trans 1` I got:

libsemanage.dbase_llist_set: record not found in the database (No such file or directory).
libsemanage.dbase_llist_set: could not set record value (No such file or directory).
Could not change boolean httpd_disable_trans
Could not change policy booleans

I guess the value you mean has a different name in my installation?

getsebool -a|grep httpd
allow_httpd_anon_write --> off
allow_httpd_mod_auth_ntlm_winbind --> off
allow_httpd_mod_auth_pam --> off
allow_httpd_sys_script_anon_write --> off
httpd_builtin_scripting --> on
httpd_can_network_connect --> off
httpd_can_network_connect_cobbler --> off
httpd_can_network_connect_db --> off
httpd_can_network_relay --> off
httpd_can_sendmail --> off
httpd_dbus_avahi --> on
httpd_enable_cgi --> on
httpd_enable_ftp_server --> off
httpd_enable_homedirs --> off
httpd_execmem --> off
httpd_read_user_content --> off
httpd_ssi_exec --> off
httpd_tmp_exec --> off
httpd_tty_comm --> on
httpd_unified --> off
httpd_use_cifs --> off
httpd_use_gpg --> off
httpd_use_nfs --> off

sealert -l 6bf2a6f9-223c-41e9-9921-1fe975979551

Summary:

SELinux is preventing /usr/sbin/httpd "getattr" access to
/etc/pki/tls/private/localhost.key.

Detailed Description:

[SELinux is in permissive mode. This access was not denied.]

SELinux denied access requested by httpd. /etc/pki/tls/private/localhost.key may
be a mislabeled. /etc/pki/tls/private/localhost.key default SELinux type is
cert_t, but its current type is admin_home_t. Changing this file back to the
default type, may fix your problem.

File contexts can be assigned to a file in the following ways.

* Files created in a directory receive the file context of the parent
directory by default.
* The SELinux policy might override the default label inherited from the
parent directory by specifying a process running in context A which creates
a file in a directory labeled B will instead create the file with label C.
An example of this would be the dhcp client running with the dhclient_t type
and creating a file in the directory /etc. This file would normally receive
the etc_t type due to parental inheritance but instead the file is labeled
with the net_conf_t type because the SELinux policy specifies this.
* Users can change the file context on a file using tools such as chcon, or
restorecon.

This file could have been mislabeled either by user error, or if an normally
confined application was run under the wrong domain.

However, this might also indicate a bug in SELinux because the file should not
have been labeled with this type.

If you believe this is a bug, please file a bug report against this package.

Allowing Access:

You can restore the default system context to this file by executing the
restorecon command. restorecon '/etc/pki/tls/private/localhost.key', if this
file is a directory, you can recursively restore using restorecon -R
'/etc/pki/tls/private/localhost.key'.

Fix Command:

/sbin/restorecon '/etc/pki/tls/private/localhost.key'

Additional Information:

Source Context unconfined_u:system_r:httpd_t:s0
Target Context unconfined_u:object_r:admin_home_t:s0
Target Objects /etc/pki/tls/private/localhost.key [ file ]
Source httpd
Source Path /usr/sbin/httpd
Port
Host smarty.domain.com
Source RPM Packages httpd-2.2.17-1.fc13.1
Target RPM Packages
Policy RPM selinux-policy-3.7.19-10.fc13
Selinux Enabled True
Policy Type targeted
Enforcing Mode Permissive
Plugin Name restorecon
Host Name smarty.domain.com
Platform Linux smarty.domain.com 2.6.33.3-85.fc13.x86_64 #1
SMP Thu May 6 18:09:49 UTC 2010 x86_64 x86_64
Alert Count 9
First Seen Tue Dec 7 14:06:48 2010
Last Seen Tue Dec 7 16:38:24 2010
Local ID 6bf2a6f9-223c-41e9-9921-1fe975979551
Line Numbers

Raw Audit Messages

node=smarty.domain.com type=AVC msg=audit(1291736304.119:3020): avc: denied { getattr } for pid=3623 comm="httpd" path="/etc/pki/tls/private/localhost.key" dev=dm-4 ino=1179673 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:admin_home_t:s0 tclass=file

node=smarty.domain.com type=SYSCALL msg=audit(1291736304.119:3020): arch=c000003e syscall=4 success=yes exit=0 a0=7f6c9e2e25a8 a1=7fff0fa02ab0 a2=7fff0fa02ab0 a3=1bb items=0 ppid=3622 pid=3623 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts7 ses=1 comm="httpd" exe="/usr/sbin/httpd" subj=unconfined_u:system_r:httpd_t:s0 key=(null)

So I tried:

/sbin/restorecon '/etc/pki/tls/private/localhost.key'

and tried again. I will post again with more results.

Christian
Yeshua loves you!
Christian Deutsch_1
Esteemed Contributor

Re: Apache startup failed (points!)

After applying the restorecon fix commands (see my previous post) now I get the following messages in /var/log/messages:

Dec 8 12:02:11 smarty dbus: avc: received setenforce notice (enforcing=1)
Dec 8 12:02:11 smarty dbus: avc: received setenforce notice (enforcing=1)
Dec 8 12:02:11 smarty dbus: Can't send to audit system: USER_AVC avc: received setenforce notice (enforcing=1)#012: exe="?" sauid=81 hostname=? addr=? terminal=?
Dec 8 12:02:11 smarty dbus: [system] Reloaded configuration
Dec 8 12:04:23 smarty dbus: avc: received setenforce notice (enforcing=0)
Dec 8 12:04:23 smarty dbus: avc: received setenforce notice (enforcing=0)
Dec 8 12:04:23 smarty dbus: Can't send to audit system: USER_AVC avc: received setenforce notice (enforcing=0)#012: exe="?" sauid=81 hostname=? addr=? terminal=?
Dec 8 12:05:37 smarty dbus: avc: received setenforce notice (enforcing=1)
Dec 8 12:05:37 smarty dbus: avc: received setenforce notice (enforcing=1)
Dec 8 12:05:37 smarty dbus: Can't send to audit system: USER_AVC avc: received setenforce notice (enforcing=1)#012: exe="?" sauid=81 hostname=? addr=? terminal=?
Dec 8 12:05:37 smarty dbus: [system] Reloaded configuration

Behaviour with SELinux is now:

Enforced mode: web page is not served (0 bytes are served)
Permissive mode: everything is fine

If you want me to try any more tweaks with SELinux you can give me some hints.

Christian
Yeshua loves you!