nextcloud / docker

⛴ Docker image of Nextcloud
https://hub.docker.com/_/nextcloud/
GNU Affero General Public License v3.0
6.04k stars 1.83k forks source link

SSL troubles in Nextcloud Docker deployment #1554

Closed mat-l closed 1 year ago

mat-l commented 3 years ago

Dear all, I have installed Nextcloud Docker as shown in the example esection over here with docker-compose: https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/mariadb/apache/docker-compose.yml

The deployed instance works fine so far, but there is a small trouble while conecting clients to Nextcloud. On mobile (iOS, Android) and desktop clients (testet Windows so far) , I cannot "Grant Access" as something seems wrong with the https connection.

In the desktop client shows the following error: grafik

In the Android Bookmark App it shows this error: grafik

An if I open DAVx5 in Android Nextcloud App to Grant Access to sync calendar and contacts it waits in this state: grafik

As Nextcloud does not show any further information in the Logs I am also attaching the DAVx5 logs:

f--- BEGIN DEBUG INFO ---

EXCEPTION
at.bitfire.dav4jvm.exception.HttpException: HTTP 301 Moved Permanently
    at at.bitfire.davdroid.ui.setup.NextcloudLoginFlowFragment$LoginFlowModel.postForJson(NextcloudLoginFlowFragment.kt:19)
    at at.bitfire.davdroid.ui.setup.NextcloudLoginFlowFragment$LoginFlowModel.access$postForJson(NextcloudLoginFlowFragment.kt:1)
    at at.bitfire.davdroid.ui.setup.NextcloudLoginFlowFragment$LoginFlowModel$checkResult$1.invokeSuspend(NextcloudLoginFlowFragment.kt:13)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:3)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:18)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:1)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:11)

HTTP REQUEST
Request{method=POST, url=http://mydomain.de/login/v2/poll, headers=[Accept-Encoding:br,gzip]}

HTTP RESPONSE
Response{protocol=http/1.1, code=301, message=Moved Permanently, url=http://mydomain.de/login/v2/poll}
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.21.1</center>
</body>
</html>

SOFTWARE INFORMATION

┌────────────────────────────────┬────────────┬───────────┬──────────────────────────────┬───────┐
│ Package                        │ Version    │ Code      │ Installer                    │ Notes │
├────────────────────────────────┼────────────┼───────────┼──────────────────────────────┼───────┤
│ at.bitfire.davdroid            │ 3.3.12-ose │ 303120005 │ com.android.packageinstaller │       │
│ org.dmfs.tasks                 │ 1.4.2      │ 82200     │ com.android.packageinstaller │       │
│ com.android.providers.contacts │ 11.0.0.304 │ 110000304 │ —                            │       │
│ com.android.providers.calendar │ 11.0.0.303 │ 110000303 │ —                            │       │
│ com.android.contacts           │ 11.0.0.670 │ 110000670 │ com.huawei.appmarket         │       │
│ com.android.calendar           │ 11.0.1.331 │ 110001331 │ com.huawei.appmarket         │       │
│ ws.xsoh.etar                   │ 1.0.26     │ 28        │ com.android.packageinstaller │       │
└────────────────────────────────┴────────────┴───────────┴──────────────────────────────┴───────┘

SYSTEM INFORMATION

Android version: 10 (ELE-AL00 10.1.0.162(C00E160R2P11))
Device: HUAWEI ELE-AL00 (HWELE)
Locale(s): [de_DE]

CONNECTVITY

☒ tun1
   - [ Transports: WIFI|VPN Capabilities: NOT_METERED INTERNET NOT_RESTRICTED TRUSTED VALIDATED NOT_ROAMING FOREGROUND NOT_CONGESTED NOT_SUSPENDED LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps DNN:  SSCMODE: 0 SNSSAI:  PduSessionType: 0 RouteBitmap: 0]
   - DNS: fd00::3a10:d5ff:fe62:6afa, 192.168.178.1 (private mode)
☐ wlan0
   - [ Transports: WIFI Capabilities: NOT_METERED INTERNET NOT_RESTRICTED TRUSTED NOT_VPN VALIDATED NOT_ROAMING FOREGROUND NOT_CONGESTED NOT_SUSPENDED LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps SignalStrength: -67 DNN:  SSCMODE: 0 SNSSAI:  PduSessionType: 0 RouteBitmap: 0]
   - DNS: fd00::3a10:d5ff:fe62:6afa, 192.168.178.1 (private mode)

Data saver: disabled

CONFIGURATION

App standby bucket: 5
Power saving disabled: yes
System-wide synchronization: automatically

Notifications:
- sync isBlocked=false
  * syncProblems: importance=3
  * syncIoErrors: importance=1
  * syncWarnings: importance=2
- cert4android: importance=3
- status: importance=2
- general: importance=3
- debug: importance=3

Permissions:
- ACCESS_NETWORK_STATE: granted
- ACCESS_WIFI_STATE: granted
- FOREGROUND_SERVICE: granted
- INTERNET: granted
- READ_SYNC_SETTINGS: granted
- READ_SYNC_STATS: granted
- WRITE_SYNC_SETTINGS: granted
- RECEIVE_BOOT_COMPLETED: granted
- REQUEST_IGNORE_BATTERY_OPTIMIZATIONS: granted
- READ_CONTACTS: granted
- WRITE_CONTACTS: granted
- READ_CALENDAR: granted
- WRITE_CALENDAR: granted
- ACCESS_COARSE_LOCATION: denied
- ACCESS_FINE_LOCATION: denied
- ACCESS_BACKGROUND_LOCATION: denied
- org.dmfs.permission.READ_TASKS: granted
- org.dmfs.permission.WRITE_TASKS: granted
- org.tasks.permission.READ_TASKS: denied
- org.tasks.permission.WRITE_TASKS: denied

ACCOUNTS

- Account: mymail.de

┌──────────────────────────────────┬──────────┬───────────┬──────────┬───────────────────────────────────┐
│ Authority                        │ Syncable │ Auto-sync │ Interval │ Entries                           │
├──────────────────────────────────┼──────────┼───────────┼──────────┼───────────────────────────────────┤
│ at.bitfire.davdroid.addressbooks │ 1        │ true      │ 240 min  │ —                                 │
│ com.android.calendar             │ 1        │ true      │ 240 min  │ 10 event(s)                       │
│ org.dmfs.tasks                   │ 1        │ true      │ 240 min  │ —                                 │
│ org.tasks.opentasks              │ 0        │ false     │ 1440 min │ —                                 │
│ com.android.contacts             │ 0        │ false     │ —        │ 0 wrongly assigned raw contact(s) │
└──────────────────────────────────┴──────────┴───────────┴──────────┴───────────────────────────────────┘

  WiFi only: false
  Contact group method: GROUP_VCARDS
  Time range (past days): 90
  Default alarm (min before): null
  Manage calendar colors: true
  Use event colors: true

  * Address book: Zuletzt kontaktiert (mymail.de YA)

    ┌──────────────────────┬──────────┬───────────┬──────────┬──────────────────┐
    │ Authority            │ Syncable │ Auto-sync │ Interval │ Entries          │
    ├──────────────────────┼──────────┼───────────┼──────────┼──────────────────┤
    │ com.android.contacts │ 1        │ true      │ 1440 min │ 4 raw contact(s) │
    └──────────────────────┴──────────┴───────────┴──────────┴──────────────────┘

    URL: https:// mydomain.de/remote.php/dav/addressbooks/users/myuser/z-app-generated--contactsinteraction--recent/
    Read-only: 1

DATABASE DUMP

android_metadata

┌────────┐
│ locale │
├────────┤
│ de_DE  │
└────────┘

service

┌────┬───────────────────────────┬─────────┬─────────────────────────────────────────────────────────────────────────┐
│ id │ accountName               │ type    │ principal                                                               │
├────┼───────────────────────────┼─────────┼─────────────────────────────────────────────────────────────────────────┤
│ 3  │ mymail │ carddav │ https:// mydomain.de/remote.php/dav/principals/users/ myuser / │
│ 4  │ mymail │ caldav  │ https:// mydomain.de/remote.php/dav/principals/users/ myuser / │
└────┴───────────────────────────┴─────────┴─────────────────────────────────────────────────────────────────────────┘

sqlite_sequence

┌────────────┬──────┐
│ name       │ seq  │
├────────────┼──────┤
│ service    │ 6    │
│ homeset    │ 6    │
│ collection │ 13   │
│ syncstats  │ 1365 │
└────────────┴──────┘

homeset

┌────┬───────────┬───────────────────────────────────────────────────────────────────────────┬──────────┬─────────────┬──────────┐
│ id │ serviceId │ url                                                                       │ privBind │ displayName │ personal │
├────┼───────────┼───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────┼──────────┤
│ 3  │ 4         │ https:// mydomain.de/remote.php/dav/calendars/ myuser /          │ 1        │ —           │ 1        │
│ 4  │ 3         │ https:// mydomain.de/remote.php/dav/addressbooks/users/ myuser / │ 1        │ —           │ 1        │
└────┴───────────┴───────────────────────────────────────────────────────────────────────────┴──────────┴─────────────┴──────────┘

collection

┌────┬───────────┬──────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────────────┬────────────┬───────────────┬─────────────────────┬─────────────┬───────────┬──────────┬────────────────┬───────────────┬──────────────────┬────────┬──────┬───────────┬─────────────────────────────────────────────────────────────────────────┐
│ id │ serviceId │ type         │ url                                                                                                                    │ privWriteContent │ privUnbind │ forceReadOnly │ displayName         │ description │ color     │ timezone │ supportsVEVENT │ supportsVTODO │ supportsVJOURNAL │ source │ sync │ homeSetId │ owner                                                                   │
├────┼───────────┼──────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────────────┼────────────┼───────────────┼─────────────────────┼─────────────┼───────────┼──────────┼────────────────┼───────────────┼──────────────────┼────────┼──────┼───────────┼─────────────────────────────────────────────────────────────────────────┤
│ 5  │ 4         │ CALENDAR     │ https:// mydomain.de/remote.php/dav/calendars/ myuser /personal/                                              │ 1                │ 1          │ 0             │ Persönlich          │ —           │ -12591386 │ —        │ 1              │ 0             │ 0                │ —      │ 1    │ 3         │ https:// mydomain.de/remote.php/dav/principals/users/ myuser / │
│ 9  │ 4         │ CALENDAR     │ https:// mydomain.de/remote.php/dav/calendars/ myuser /aufgaben/                                              │ 1                │ 1          │ 0             │ Aufgaben            │ —           │ -16743735 │ —        │ 0              │ 1             │ 0                │ —      │ 1    │ 3         │ https:// mydomain.de/remote.php/dav/principals/users/ myuser / │
│ 12 │ 3         │ ADDRESS_BOOK │ https:// mydomain.de/remote.php/dav/addressbooks/users/ myuser /z-app-generated--contactsinteraction--recent/ │ 0                │ 0          │ 0             │ Zuletzt kontaktiert │ —           │ —         │ —        │ —              │ —             │ —                │ —      │ 1    │ 4         │ https:// mydomain.de/remote.php/dav/principals/users/ myuser / │
└────┴───────────┴──────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────────┴────────────┴───────────────┴─────────────────────┴─────────────┴───────────┴──────────┴────────────────┴───────────────┴──────────────────┴────────┴──────┴───────────┴─────────────────────────────────────────────────────────────────────────┘

room_master_table

┌────┬──────────────────────────────────┐
│ id │ identity_hash                    │
├────┼──────────────────────────────────┤
│ 42 │ 7e4bfdf7f9fa3529c333cf9485f8cf50 │
└────┴──────────────────────────────────┘

syncstats

┌──────┬──────────────┬──────────────────────┬───────────────┐
│ id   │ collectionId │ authority            │ lastSync      │
├──────┼──────────────┼──────────────────────┼───────────────┤
│ 1362 │ 5            │ com.android.calendar │ 1628180777989 │
│ 1365 │ 12           │ com.android.contacts │ 1628183899167 │
└──────┴──────────────┴──────────────────────┴───────────────┘

APP SETTINGS

1. SharedPreferencesProvider canWrite=true

┌───────────────────────────┬───────────────┐
│ Setting                   │ Value         │
├───────────────────────────┼───────────────┤
│ distrust_system_certs     │ false         │
│ foreground_service        │ false         │
│ hint_AutostartPermissions │ false         │
│ override_proxy            │ false         │
│ override_proxy_host       │ localhost     │
│ override_proxy_port       │ 8118          │
│ time_nextDonationPopup    │ 1634557986263 │
└───────────────────────────┴───────────────┘

2. DefaultsProvider canWrite=false

┌───────────────────────┬───────────┐
│ Setting               │ Value     │
├───────────────────────┼───────────┤
│ default_sync_interval │ 14400     │
│ distrust_system_certs │ false     │
│ override_proxy        │ false     │
│ override_proxy_host   │ localhost │
│ override_proxy_port   │ 8118      │
└───────────────────────┴───────────┘

--- END DEBUG INFO ---
mojo17 commented 3 years ago

I got the same issue with the Windows client. I was able to fix it by adding the following setting to my config.php:

'overwriteprotocol' => 'https',

Another relevant setting is trusted_proxies. It might be helpful to define in some cases.

Here's the screenshot of the error in English:

image

mat-l commented 3 years ago

Thanks for the hint @mojo17 that works so far for me. Anyways it would be great if the standard deployment is correct configured by the Nextcloud team.