michaelryanmcneill / shibboleth

Shibboleth plugin for WordPress
https://wordpress.org/plugins/shibboleth/
21 stars 12 forks source link

Internal Server Error when mod_shib is not installed #60

Closed jrchamp closed 4 years ago

jrchamp commented 5 years ago

This came up on the WordPress plugin support forum: https://wordpress.org/support/topic/sibboleth-installation-internal-server-error/

It's fair to say that we do expect people to install the mod_shib package before installing our plugin, but it might also be good to not take their site offline. In that ticket, I suggest wrapping the Shibboleth configuration directives in an IfModule block, as in:

<IfModule mod_shib>
    AuthType shibboleth
    Require shibboleth
</IfModule>

Is this something that we would be interested in adding to the core plugin? If so, I'd be happy to create a pull request.

michaelryanmcneill commented 4 years ago

I think that is a great idea and is something we probably should do in the first place. If you have time @jrchamp and want to put this into a quick PR, that'd be great. If not, I'll try to take care of it next week during my routine maintenance work.

michaelryanmcneill commented 4 years ago

This will be implemented in the pending 2.2 release. Thanks for the suggestion @jrchamp!

michaelryanmcneill commented 4 years ago

Reopened because of the issues found in #64. Once we hear back from the reporters, we can attempt to resolve the issue in cPanel environments.

jdpurdyvi commented 4 years ago

From my sysadmin

Shibboleth runs as a daemon, outside of apache.

That said, php is also running with fcgi and not mod_php

michaelryanmcneill commented 4 years ago

Could you @jdpurdyvi possibly add a file somewhere in the same location as your WordPress install with this and provide the output:

<?php
print_r(apache_get_modules());
?>

The output should be something like:

Array
(
    [0] => core
    [1] => http_core
    [2] => mod_so
    [3] => sapi_apache2
    [4] => mod_mime
    [5] => mod_rewrite
)
jdpurdyvi commented 4 years ago

PHP is running with fcgi so apache_get_modules() is not available e.g. [18-Jun-2020 20:39:34 UTC] PHP Fatal error: Uncaught Error: Call to undefined function apache_get_modules() in /my/wp/path:57

michaelryanmcneill commented 4 years ago

Haha, of course it is. Can you try seeing if the module name shows up in phpinfo()?

jdpurdyvi commented 4 years ago

Short answer is no. But I sent you the full output of phpinfo() privately @michaelryanmcneill in case you want to verify.

dandalpiaz commented 4 years ago

The admins for our cPanel host said that they were able to make things work by using the filename instead of the identifier for the module: <IfModule mod_shib.cpp>

Not sure if that will be the case for all cPanel environments though.

jrchamp commented 4 years ago

mod_shib.cpp makes sense because the Shibboleth SP module is written in C++.

michaelryanmcneill commented 4 years ago

Just to be safe, I've gone ahead and added mod_shib.c and mod_shib.cpp in addition to mod_shib. I've committed it with 7affc23 and I've created a draft release. If @dandalpiaz, @jdpurdyvi, and @jrchamp (and others) could test it out before I release it to the WordPress.org repository, that would be wonderful. I want to try and avoid breaking things for others again if possible. If I don't hear anything back I'll release it on Tuesday afternoon.

jrchamp commented 4 years ago

I tested this configuration on my test system and it's working for me, but the previous change did also.

michaelryanmcneill commented 4 years ago

Thanks @jrchamp!

jdpurdyvi commented 4 years ago

mod_shib.cpp is what works on my host. Thanks!

dandalpiaz commented 4 years ago

The mod_shib.cpp conditional is working on our cPanel host as well. Thanks @michaelryanmcneill !

michaelryanmcneill commented 4 years ago

Great, with these confirmations, I'll merge these changes and push the release out.