boredazfcuk / docker-icloudpd

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

Remote Re-authentication error #556

Closed cream68 closed 3 weeks ago

cream68 commented 1 month ago

Problem: I attempted to utilize the Telegram send features, specifically the "Remote Re-authentication" feature. However, I encountered an error consistently during this process.

(file "/opt/authenticate.exp" line 39) "expect eof" while executing expect: spawn id exp4 not open expect: set expect_out(buffer) "su: unknown user \r\nrm: cannot remove '/tmp/icloudpd/reauth.log': No such file or directory\r\n" expect: set expect_out(spawn_id) "exp4" expect: read eof "Please enter two-factor authentication code or device index * to send SMS with a code: "? no expect: does "su: unknown user \r\nrm: cannot remove '/tmp/icloudpd/reauth.log': No such file or directory\r\n" (spawn_id exp4) match glob pattern "Please enter two-factor authentication code: "? no

rm: cannot remove '/tmp/icloudpd/reauth.log': No such file or directory "Please enter two-factor authentication code or device index * to send SMS with a code: "? no expect: does "su: unknown user \r\n" (spawn_id exp4) match glob pattern "Please enter two-factor authentication code: "? no

su: unknown user "Please enter two-factor authentication code or device index * to send SMS with a code: "? no expect: does "" (spawn_id exp4) match glob pattern "Please enter two-factor authentication code: "? no

spawn: returns {2969} parent: now unsynchronized from child parent: telling child to go ahead parent: waiting for sync byte 2024-05-05 17:24:23 DEBUG Starting authentication process 2024-05-05 17:24:23 DEBUG Telegram remotesync notification sent successfully 2024-05-05 17:24:23 INFO Sending Telegram remotesync notification

The error seems to occur while attempting remote re-authentication via Telegram. Any ideas how to fix this?

boredazfcuk commented 1 month ago

Yeah, upstream changes which re-introduced the capability to re-authenticate MFA using SMS altered the output of the script and broke the re-authentication script. I got about 3/4 of the way through debugging it, but then Apple blocked MFA from my account saying I'd made too many requests in a short period of time. I'm on cool-down at the moment and will pick up testing when my account resets.

boredazfcuk commented 1 month ago

I've just tested it on my personal account and it's still working OK. There's just a lot of logging going off as I've accidentally left on verbose debugging.

It will likely fail if the account has a trusted recovery number attached to the account, as that will allow MFA reauthentication via SMS and that's the bit I was testing when I got blocked by Apple. I believe I had actually got it working though, just never got to test if for confirmation.

boredazfcuk commented 1 month ago

Actually i think this is a bug. I'd not accounted for the possibility that the user variable had not been set in the icloudpd.conf file. I've changed it so that it uses the same default as the main script if the variable is not configured in the configuration file.

Update to the latest version and give it another go.

cream68 commented 1 month ago

I updated the docker, the problem still remains. The error log is the same as in the beginning, despite the line

su: unknown user

changed to

su: unknown user user

boredazfcuk commented 1 month ago

What is the "user" variable in /config/icloudpd.conf set to?

cream68 commented 1 month ago

there is no "user" variable saved, but in the logs it says: Sync user:

boredazfcuk commented 1 month ago

Odd. If a container environment variable is set, it should write that to the icloudpd.conf and then use that file to load the variables.

I'll have to double check the logic for this.

cream68 commented 1 month ago

Can we mark the topic as open?

maydaytek commented 3 weeks ago

Want to add I'm experiencing the same su: unknown user user

There is no user set in icloudpd.conf but I do have user set in the container variables.

EDIT I did just manually add the user variable to icloudpd.conf and the remote re-auth worked perfectly.

bshep commented 3 weeks ago

this line: https://github.com/boredazfcuk/docker-icloudpd/blob/50de787d6d8a17f5db9c5ec662a4a041a29fc9bb/init_config.sh#L70C13-L70C28

reads: if [ "$(grep -c "user=" "${config_file}")" -eq 0 ]; then echo user="${user:=user}"; fi should read: if [ "$(grep -c "^user=" "${config_file}")" -eq 0 ]; then echo user="${user:=user}"; fi

Otherwise it will match lines like:

msmtp_user=
pushover_user=
touser=
boredazfcuk commented 3 weeks ago

this line:

https://github.com/boredazfcuk/docker-icloudpd/blob/50de787d6d8a17f5db9c5ec662a4a041a29fc9bb/init_config.sh#L70C13-L70C28

reads:

if [ "$(grep -c "user=" "${config_file}")" -eq 0 ]; then echo user="${user:=user}"; fi

should read:

if [ "$(grep -c "^user=" "${config_file}")" -eq 0 ]; then echo user="${user:=user}"; fi

Otherwise it will match lines like:


msmtp_user=

pushover_user=

touser=

Yeah I spotted that and fixed it maybe a month, or longer, ago.

Although,I also messed up quite a bit of code with a dodgy find/replace for all files, across all my repos. Maybe the backup I restored from didn't include that change. Hmmmmm. I'll have to check.

boredazfcuk commented 3 weeks ago

I checked and it was fixed in the reauth.sh script, but not the init_config.sh launch script. Fixed and pushed to Dockerhub