-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make OAuth work out of the box with Apache servers (install dependencies, etc.) #49
Comments
the documentation already states that these modules should be enabled:
@DeepDiver1975 @PVince81 we probably should add |
Makefiles are only available at development time. |
@DeepDiver1975 and what about checking available apache modules when installing apps? |
http://php.net/manual/de/function.apache-get-modules.php but is this enough? no idea |
would prevent installing an app if an apache module is not enabled. would fix this issue IMO |
what about other web servers? |
Another thing that might be worth doing is to detect this error in the client in order to advice the user properly. |
@felixboehm @PVince81 please find assignment and move to 'development' milestone then |
Server is fine as it is
Open task
|
its not possible to make a difference between an unauthorized request and a request where the auth header was eaten. they look identical. nothing we can do on server side from my pov |
We can however detect that in the client side. |
the message is not translated as it comes from the sabre dav lib |
I don't like much the idea of matching error messages to decide logic :\ |
got it. So clients can handle the error gracefully, not related to server.
|
Error message in clients will be a bit odd; something like
|
Actually, it seems I can't detect it in the client because Qt won't allow me to get the body of a request with a 401. (@guruz do you know a way?) Edit: For reference, this is the patch i had in mind: https://paste.kde.org/p95vbqysr (but it does not work) |
Note: is stripping that header happening in the default Apache configuration, or is it something that is specific to SolidGear's server? I was under the impression that it was a problem with the default settings, but if it is not the case, detecting this in the clients is much less important. |
yes - we have a setting in place in htacess which prevents this. but this requires mod_rewrite and htaccess handling needs to be in place
|
no concept for a fix until now, moving to triage |
Would it work to send an You could add comment about the needed Apache config changes also to the app readme: https://github.com/owncloud/oauth2/blob/master/README.md |
We also saw this one in https://hub.docker.com/r/owncloud/server/ containers (10.0.3beta & that actually do include the required modules) - @pmaier1 pointed that OAuth app does not work there and I'm currently trying to debug what's wrong with that apache config |
@jvillafanez has been helping me debugging the scenario in #49 (comment) (OAuth2 app not working in https://hub.docker.com/r/owncloud/server/ 10.0.3beta1 containers) without success: We have the required (headers & rewrite) modules loaded, the
@DeepDiver1975 @butonic we might use some apache deep-knowledge here. This shit is bananas |
missing space after : ??? |
@DeepDiver1975 No luck... still getting 401'd 😕 |
@SamuAlfageme paste the curl again pls. Also, are the other modules enabled? see #49 (comment) |
Apache modules loaded:
|
Tried enabling |
Ok, we found it. Turns out both $ docker run -d -p 80:80 -p 443:443 --name owncloud owncloud/server:10.0.3beta
$ diff \
<(wget -O- -q https://raw.githubusercontent.com/owncloud-docker/base/master/rootfs/etc/apache2/sites-enabled/000-default.conf) \
<(docker exec owncloud cat /etc/apache2/sites-enabled/000-default.conf) 8,10c8
< Alias ${OWNCLOUD_SUB_URL} /var/www/owncloud
<
< <Directory /var/www/owncloud>
---
> <Location />
13c11
< </Directory>
---
> </Location>
28,30c26
< Alias /owncloud /var/www/owncloud
<
< <Directory /var/www/owncloud>
---
> <Location />
33c29
< </Directory>
---
> </Location> ... this messes up with OAuth app (and potentially some others). Replacing one for the other fixes it. Note that this switch is made in one the owncloud initialization scripts: https://github.com/owncloud-docker/base/blob/master/rootfs/etc/owncloud.d/90-services.sh#L8-L12 (since cc/ @tboerger any reason on why this replacement is needed (in general)? The scripts could be better documented for apache non-familiar people. |
I have consolidated the available configurations but currently I can't believe that this will really solve something: owncloud-docker/base@9d4cc6e |
@tboerger it solved the headers issues as expected: $ docker run -d -p 80:80 -p 443:443 --name owncloud owncloud/server:10.0.3beta
4d7199b754c5fe1bae18e0045b0ee9638e2c530f61c51f125f396e5cd9616f63
$ docker exec --user www-data owncloud bash -c 'mkdir /var/www/owncloud/apps/oauth2 && curl -L https://api.github.com/repos/owncloud/oauth2/tarball/master | tar xz --strip=1 -C /var/www/owncloud/apps/oauth2 && php /var/www/owncloud/occ app:enable oauth2'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 59018 100 59018 0 0 33581 0 0:00:01 0:00:01 --:--:-- 251k
oauth2 enabled
[...]
$ curl -i --insecure \
-H 'Authorization:Bearer uW4Mwv7EV1bZ12ejZY8ZBYtfTHuXDvrzYCg81MIy7UPucBfCSQp0SDRgaU2UbWgW' \
-H 'User-Agent:Mozilla/5.0 (Macintosh) mirall/2.4.0-nightly20170802 (build 8119)' \
-X PROPFIND 'https://alfageme/remote.php/webdav/' \
--data-binary '<?xml version="1.0" ?>
<d:propfind xmlns:d="DAV:">
<d:prop>
<d:getlastmodified />
</d:prop>
</d:propfind>
'
HTTP/1.1 207 Multi-Status
[...] |
@SamuAlfageme @tboerger Location directives overwrite Directory directives. See last example in http://httpd.apache.org/docs/current/sections.html#merging Can we now close this? It is a configuration issue. |
It should be working fine with the containers. |
In my case the virtual host configuration shared below worked:
The only change I made in the virtual conf is the addition of first line:
|
In my case the problem was with multiple virtual host configurations spread across different apache site-enabled configs. So each config file enabled in the sites-enabled had virtualhost *:80 directive. When I removed the unused ones and kept the config which I was using, it worked. Hence our configuration works out of box. Thanks @butonic for helping hand to find the real root cause. Hence closing this issue. |
btw another cause of this might be a bad php-fpm config. fpm is not supported. that being said have a look at https://linode.com/docs/web-servers/apache/running-fastcgi-php-fpm-on-debian-7-with-apache/ how to correctly pass auth headers to it (without REDIRECT_ prefixes). |
I was having some problems while using the OAuth app from the desktop client: owncloud/client#5668 (comment). When doing the
PROPFIND
with the token we got from the application on redirection:... you'll find how the server is discarding the
Authorization
headers:From some notes from previous OAuth meetings (cc/ @davivel @DeepDiver1975):
Installing these modules proved to make the login from the clients work seamlessly.
EDIT @tomneedham: Apache VHost must allow our .htaccess to work by using
AllowOverride All
These dependencies could be included on the app's
Makefile
(create one, as first step) and tackle down if there's something else missing to make the app work out-of-the-box.The text was updated successfully, but these errors were encountered: