boredazfcuk / docker-icloudpd

An Alpine Linux container for the iCloud Photos Downloader command line utility
1.58k stars 149 forks source link

no prompt for password after --init #601

Open lcx opened 3 days ago

lcx commented 3 days ago

I'm not being prompted for password after --init and after a while the container is just stopped and is being restarted.

root@icloudpd_cris:/> sync-icloud.sh --Initialise

2024-07-03 13:36:45 INFO     ***** boredazfcuk/icloudpd container v1.0.885_01-07-2024 started *****
2024-07-03 13:36:45 INFO     ***** For support, please go here: https://github.com/boredazfcuk/docker-icloudpd *****
2024-07-03 13:36:45 INFO     Alpine Linux 3.20.1
2024-07-03 13:36:45 INFO     Python version: 3.12.3
2024-07-03 13:36:49 INFO     icloud-photos-downloader version: 1.20.4
2024-07-03 13:36:49 INFO     Checking for updates...
2024-07-03 13:36:50 INFO      - Current version is up to date.
2024-07-03 13:36:50 INFO     Loading configuration from: /config/icloudpd.conf
2024-07-03 13:36:51 INFO     Apple ID: me@example.com
2024-07-03 13:36:51 INFO     Authentication Type: MFA
2024-07-03 13:36:51 INFO     Cookie path: /config/cristianlivadarunet
2024-07-03 13:36:51 INFO     Cookie expiry notification period: 7
2024-07-03 13:36:51 INFO     Download destination directory: /home/cristian/iCloud
2024-07-03 13:36:51 INFO     Folder structure: {:%Y/%m/%d}
2024-07-03 13:36:51 INFO     Keep Unicode: true
2024-07-03 13:36:51 INFO     Live Photo MOV Filename Policy: suffix
2024-07-03 13:36:51 INFO     File Match Policy: name-size-dedup-with-suffix
2024-07-03 13:36:51 INFO     Synchronisation interval: 86400
2024-07-03 13:36:51 INFO     Synchronisation delay (minutes): 0
2024-07-03 13:36:51 INFO     Set EXIF date/time: false
2024-07-03 13:36:51 INFO     Auto delete: false
2024-07-03 13:36:51 INFO     Delete after download: false
2024-07-03 13:36:51 INFO     Delete empty directories: false
2024-07-03 13:36:51 INFO     Photo size: original
2024-07-03 13:36:51 INFO     Align RAW: as-is
2024-07-03 13:36:51 INFO     Single pass mode: false
2024-07-03 13:36:51 INFO     Skip download check: false
2024-07-03 13:36:51 INFO     Skip live photos: false
2024-07-03 13:36:51 INFO     Number of most recently added photos to download: Download All Photos
2024-07-03 13:36:51 INFO     Downloading photos from: Download All Photos
2024-07-03 13:36:51 INFO     Stop downloading when prexisiting files count is: Download All Photos
2024-07-03 13:36:51 INFO     Live photo size: original
2024-07-03 13:36:51 INFO     Skip videos: false
2024-07-03 13:36:51 INFO     Convert HEIC to JPEG: false
2024-07-03 13:36:51 INFO     Pushover notifications enabled
2024-07-03 13:36:51 INFO     Pushover user: ffoo
2024-07-03 13:36:51 INFO     Pushover token: bar
2024-07-03 13:36:51 INFO     Sending Pushover startup notification
2024-07-03 13:36:52 INFO     Downloading from: icloud.com
2024-07-03 13:36:52 INFO     Authentication domain: com
2024-07-03 13:36:52 INFO     Ignore Synology extended attribute directories: Disabled
2024-07-03 13:36:52 INFO     Container initialisation complete
2024-07-03 13:36:52 INFO     Script launch parameters: --Initialise

Here is my compose file:

version: "3.8"

services:
   icloudpd_cris:
      hostname: icloudpd_cris
      environment:
         - TZ=Europe/Vienna
         - apple_id=me@example.com
         - user=cristian
         - user_id=1026
         - group=users
         - gid=100
         - authentication_type=MFA
         - folder_structure={:%Y/%m/%d}
         - directory_permissions=750
         - file_permissions=640
         - convert_heic_to_jpeg=
         - delete_heic_jpegs=
         - synchronisation_interval=86400
         - notification_days=7
         - notification_type=Pushover
         - convert_heic_to_jpeg=false
         - keep_unicode=true
         - pushover_user=foo
         - pushover_token=bar
      image: boredazfcuk/icloudpd
      healthcheck:
         test: /usr/local/bin/healthcheck.sh
         start_period: 30s
      restart: always
      volumes:
         - /volume1/docker/icloudpd/cristian/config:/config
         - /volume1/docker/icloudpd/cristian/photos:/home/cristian/iCloud/

anything I'm doing wrong here? I can't see any error or other issues. Also I'm trying to run this on a synology.

boredazfcuk commented 3 days ago

I've just tested on two separate containers, using both Apple and SMS MFA codes and didn't have a problem.

Can you check your /config folder and see if there are any files that look like your email address and delete them, if there are? I'm suspecting there are some leftovers from a previous run, specifically a .session file.

lcx commented 3 days ago

everything looks fine.

root@diskstation:/volume1/docker/icloudpd/cristian/config# ls -lFa
total 4
drwxr-xr-x+ 1 cristian users   26 Jul  3 13:40 ./
drwxr-xr-x+ 1 cristian users   24 Jul  3 13:08 ../
-rwxr-xr-x  1 root     root  1936 Jul  3 13:40 icloudpd.conf*

I just moved the whole config to a Debian Linux with Docker, I have the same results, so I'm definitely doing something wrong here and it's my config or something I'm doing. I will trash my config and start from scratch, the absence of some error is making it hard to know where to start with the debugging. Just to be clear on what I'm doing, this is on a fresh system:

lcx commented 3 days ago

rechecked the documentation and I'm also missing this message:

ERROR    Cookie does not exist."
INFO      - Please create your cookie using the --Initialise script command line option."
INFO      - Syntax: docker exec -it <container name> sync-icloud.sh --Initialise"
INFO      - Example: docker exec -it icloudpd sync-icloud.sh --Initialise"
INFO     Restarting in 5 minutes..."

but my config directory has only the mentioned icloudpd.conf

lcx commented 3 days ago

quick update: I tried the docker create version ... without compose and just minimal parameters (only apple_id) and then it worked. So I will remove setting after setting to see when it starts working. It seems like one of the env settings I have added causes this.

lcx commented 3 days ago

found it, as soon as I add this ENV setting it's stuck.

- group=users
boredazfcuk commented 3 days ago

Can you set debug_logging=true in your icloudpd.conf file?

The users:100 group already exists inside the container as it's a default group created by the system. In theory, it should accept this just fine. However, I noticed that one of the error logs (a log type that should always be displayed) is set to be a debug log (which are only shown when the above variable is set. I'm thinking that you may be hitting this error and this is why you see nothing before your container restarts (after 2mins at a guess).

Looking at your yaml though, this shouldn't be happening. I should know more once you add debug logging though.

Edit: Also, I found out the other day that this is actually deprecated now. Can safely remove it from your yaml.

version: "3.8"
timrettop commented 1 day ago

2024-07-03 13:36:51 INFO Cookie path: /config/cristianlivadarunet

A shot in the dark but you could try creating the folder named cristianlivadarunet in the config folder with proper ownership and not world readable (750).

boredazfcuk commented 23 hours ago

A shot in the dark but you could try creating the folder named cristianlivadarunet in the config folder with proper ownership and not world readable (750).

Minor correction in that /config/cristianlivadarunet is a file, not directory. I think you should be able to get away with 600 permissions too, as the file should always be witten/read by the local user in the container, who should be the owner.