• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Solved InfCloud (+ DAViCal + Nginx): can't make it work.

lebarondemerde

Aspiring Daemon

Thanks: 372
Messages: 984

#1
Hi,

I am completely lame in the web server subject.

So, I have www/davical (perfectly?) working under www/nginx and I want to use InfCloud as webclient (I do not know any other indeed :rolleyes:), but I can't make that work.

The InfCloud run, I can access its login page but not actually login. The only message I get in nginx logs is:

Code:
10.0.0.10 - - [22/Sep/2017:21:56:32 -0300] "PROPFIND /http://infcloud.example.org/principals/users \
HTTP/1.1" 405 173 "http://infcloud.example.org/" "Mozilla/5.0 (X11; FreeBSD amd64; rv:55.0) \
Gecko/20100101 Firefox/55.0"
The InfCloud config.js is default but:

Code:
var globalNetworkCheckSettings={
        href: 'https://dav.examples.org/',
        timeOut: 90000,
        lockTimeOut: 10000,
        checkContentType: true,
        settingsAccount: true,
        delegation: true,
        additionalResources: [],
        hrefLabel: null,
        forceReadOnly: null,
        ignoreAlarms: false,
        backgroundCalendars: []
}

var globalUseJqueryAuth=true;
This is the www/nginx configuration (already tried with ssl off, no changes):

Code:
server {

   listen       80;
   server_name   dav.example.org;
   return 301   https://$server_name$request_uri;

}

server {

   listen        443 ssl http2;
   server_name   dav.example.org;


   ssl_certificate           /usr/local/etc/ssl/certs/dav.example.org.crt;
   ssl_certificate_key       /usr/local/etc/ssl/keys/dav.example.org.key;
   ssl_dhparam           /usr/local/etc/ssl/dhparam.pem;
   ssl_ecdh_curve           X25519:secp521r1:secp384r1:prime256v1;
   ssl_protocols           TLSv1.2;
   ssl_session_cache       shared:SSL:10m;
   #ssl_stapling           on;
   #ssl_stapling_verify       on;
   ssl_session_tickets       off;
   ssl_prefer_server_ciphers   on;
   ssl_ciphers           EECDH+CHACHA20:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;


   root                  /usr/local/www/davical/htdocs;
   index                index.php;

   keepalive_timeout       0;
   charset            utf-8;


       location / {
           try_files $uri $uri/ /index.php?$args;
       }


#   rewrite ^\.well-known(.*)$ /caldav.php/.well-known$1;
#   rewrite ^principals/users(.*)$ /caldav.php$1;


       location = /.well-known/carddav {
           return 301 $scheme://$host/principals/users;
       }

       location = /.well-known/caldav {
           return 301 $scheme://$host/principals/users;
       }

       location /images/ {
       }

       location ~ ^(.+\.php)(.*)$ {
           include fastcgi_params;
           fastcgi_pass unix:/var/run/php-fpm.sock;
           fastcgi_split_path_info ^(.+\.php)(.*)$;
           fastcgi_param PATH_INFO $fastcgi_path_info;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
           fastcgi_read_timeout 180;
           fastcgi_buffers 4 256k;
           fastcgi_buffer_size 128k;
       }

       location ~ \.php {
           include fastcgi_params;
           fastcgi_pass unix:/var/run/php-fpm.sock;
           fastcgi_index index.php;
       }

}
The InfCloud readme.conf tell to add it when using it in the "cross-domain" fashion:

Code:
Access-Control-Allow-Origin *
Access-Control-Allow-Methods: GET, POST, OPTIONS, PROPFIND, PROPPATCH, REPORT, PUT, \
MOVE, DELETE, LOCK, UNLOCK
Access-Control-Allow-Headers: User-Agent, Authorization, Content-type, Depth, If-match, \
If-None-Match, Lock-Token, Timeout, Destination, Overwrite, Prefer, X-client, X-Requested-With
Access-Control-Expose-Headers: Etag, Preference-Applied
I did it already, in different places at the config file, and ... didn't work.

PS. www/nginx was built with HTTP_DAV_EXT on.

Thanks!
 
Last edited:

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 5,508
Messages: 25,692

#4
HTTP error 405 means 'Method not allowed', i.e. it doesn't understand the PROPFIND method. I'm guessing WEBDAV isn't loaded or activated.
 

lebarondemerde

Aspiring Daemon

Thanks: 372
Messages: 984

#5
Hi.

I can't find any module to load in /usr/local/libexec. Actually the nginx folder is not ever in there. I think both are buitin.

This is the last configuration, and still does not work:

Code:
server {

   listen       80;
   server_name   dav.example.org;
   return 301   https://$server_name$request_uri;

}

server {

   listen        443 ssl http2;
   server_name   dav.example.org;


   ssl_certificate           /usr/local/etc/ssl/certs/dav.example.org.crt;
   ssl_certificate_key       /usr/local/etc/ssl/keys/dav.example.org.key;
   ssl_dhparam           /usr/local/etc/ssl/dhparam.pem;
   ssl_ecdh_curve           X25519:secp521r1:secp384r1:prime256v1;
   ssl_protocols           TLSv1.2;
   ssl_session_cache       shared:SSL:10m;
   #ssl_stapling           on;
   #ssl_stapling_verify       on;
   ssl_session_tickets       off;
   ssl_prefer_server_ciphers   on;
   ssl_ciphers           EECDH+CHACHA20:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;


   root                  /usr/local/www/davical/htdocs;
   index                index.php;

   keepalive_timeout       0;
   charset            utf-8;


   add_header Access-Control-Allow-Origin *;
   add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, PROPFIND, PROPPATCH, REPORT, PUT, MOVE, DELETE, \
LOCK, UNLOCK";
   add_header Access-Control-Allow-Headers "User-Agent, Authorization, Content-type, Depth, If-match, \
If-None-Match, Lock-Token, Timeout, Destination, Overwrite, Prefer, X-client, X-Requested-With";
   add_header Access-Control-Expose-Headers "Etag, Preference-Applied";


       location / {

           try_files $uri $uri/ /index.php?$args;

           dav_methods PUT DELETE MKCOL COPY MOVE;
           dav_ext_methods PROPFIND OPTIONS;

       }


#   rewrite ^\.well-known(.*)$ /caldav.php/.well-known$1;
#   rewrite ^principals/users(.*)$ /caldav.php$1;


       location = /.well-known/carddav {
           return 301 $scheme://$host/principals/users;
       }

       location = /.well-known/caldav {
           return 301 $scheme://$host/principals/users;
       }

       location /images/ {
       }

       location ~ ^(.+\.php)(.*)$ {
           fastcgi_pass unix:/var/run/php-fpm.sock;
           fastcgi_split_path_info ^(.+\.php)(.*)$;
           fastcgi_param PATH_INFO $fastcgi_path_info;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
           fastcgi_read_timeout 180;
           fastcgi_buffers 4 256k;
           fastcgi_buffer_size 128k;
           include fastcgi_params;
       }

       location ~ \.php {
           fastcgi_pass unix:/var/run/php-fpm.sock;
           fastcgi_index index.php;
           include fastcgi_params;
       }

}
Tho current message in access.log:

Code:
10.0.0.10 - lbdm [25/Sep/2017:17:55:15 -0300] "PROPFIND / HTTP/2.0" 207 572 \
"http://infcloud.example.org/" "Mozilla/5.0 (X11; FreeBSD amd64; rv:55.0) \
Gecko/20100101 Firefox/55.0"
DAVdroid works fine.

Thanks!
 

lebarondemerde

Aspiring Daemon

Thanks: 372
Messages: 984

#7
Not exactly what I had in mind but it works.

Code:
server {

   listen       80;
   server_name   dav.example.org;
   return 301   https://$server_name$request_uri;

}

server {

   listen        443 ssl http2;
   server_name   dav.example.org;


   ssl_certificate           /usr/local/etc/ssl/certs/dav.example.org.crt;
   ssl_certificate_key       /usr/local/etc/ssl/keys/dav.example.org.key;
   ssl_dhparam           /usr/local/etc/ssl/dhparam.pem;
   ssl_ecdh_curve           X25519:secp521r1:secp384r1:prime256v1;
   ssl_protocols           TLSv1.2;
   ssl_session_cache       shared:SSL:10m;
   #ssl_stapling           on;
   #ssl_stapling_verify       on;
   ssl_session_tickets       off;
   ssl_prefer_server_ciphers   on;
   ssl_ciphers           EECDH+CHACHA20:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;


   root                  /usr/local/www/davical/htdocs;
   index                index.php index.html;

   keepalive_timeout       0;
   charset            utf-8;


       location / {

           try_files $uri $uri/ /index.php?$args;

       }


#   rewrite ^\.well-known(.*)$ /caldav.php/.well-known$1;
#   rewrite ^principals/users(.*)$ /caldav.php$1;


       location = /.well-known/carddav {
           return 301 $scheme://$host/principals/users;
       }

       location = /.well-known/caldav {
           return 301 $scheme://$host/principals/users;
       }

       location /infcloud {

           alias   /usr/local/www/infcloud;
       }

       location /images/ {

       }

       location ~ ^(.+\.php)(.*)$ {
           fastcgi_pass unix:/var/run/php-fpm.sock;
           fastcgi_split_path_info ^(.+\.php)(.*)$;
           fastcgi_param PATH_INFO $fastcgi_path_info;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
           fastcgi_read_timeout 180;
           fastcgi_buffers 4 256k;
           fastcgi_buffer_size 128k;
           include fastcgi_params;
       }

       location ~ \.php {
           fastcgi_pass unix:/var/run/php-fpm.sock;
           fastcgi_index index.php;
           include fastcgi_params;
       }

}
The InfCloud config.js should be the default one, zero modifications.