Skip to content
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

No Logout possible when using a Docker container #1185

Closed
Orbocom opened this issue Dec 16, 2020 · 15 comments · Fixed by #1187
Closed

No Logout possible when using a Docker container #1185

Orbocom opened this issue Dec 16, 2020 · 15 comments · Fixed by #1187
Labels
Bug Something isn't working Fixed

Comments

@Orbocom
Copy link

Orbocom commented Dec 16, 2020

onedrive app has ran succesfully in docker container.
After change of MS OneDrive password, docker container onedrive stops immediately after start, requesting for --logout
As container has stopped I cannot request logout, therefore cannot reauthorize.

System

Application Log Output:

++ stat /onedrive/data -c %u
+ : 1000
++ stat /onedrive/data -c %g
+ : 1000
++ getent group 1000
+ odgroup=
+ odgroup=onedrive
+ groupadd onedrive -g 1000
++ getent passwd 1000
+ oduser=
+ oduser=onedrive
+ useradd -m onedrive -u 1000 -g 1000
+ chown onedrive:onedrive /onedrive/ /onedrive/conf
+ ARGS=(--monitor --confdir /onedrive/conf --syncdir /onedrive/data)
+ '[' 0 == 1 ']'
+ '[' 0 == 1 ']'
+ '[' 0 == 1 ']'
+ '[' 0 == 1 ']'
+ '[' 0 == 1 ']'
+ '[' 0 -gt 0 ']'
+ exec gosu onedrive /usr/local/bin/onedrive --monitor --confdir /onedrive/conf --syncdir /onedrive/data
Configuration file successfully loaded
Configuring Global Azure AD Endpoints

ERROR: Microsoft OneDrive API returned an error with the following message:
  Error Message:    HTTP request returned status code 400 (Bad Request)
  Error Reason:     AADSTS70000: The user could not be authenticated as the grant is expired. The user must sign in again.
Trace ID: 00a99569-82ad-4f6d-8f34-5106dbb17800
Correlation ID: bd8168d0-4097-4530-83d1-df7d4e8a508a
Timestamp: 2020-12-16 12:38:14Z
  Calling Function: acquireToken()


ERROR: Microsoft OneDrive API returned an error with the following message:
  Error Message:    HTTP request returned status code 401 (Unauthorized)
  Error Reason:     Access token is empty.
  Error Timestamp:  2020-12-16T12:38:14
  API Request ID:   0fb3e265-a7ba-4d63-80ce-37ed78fe95ca
  Calling Function: init()

ERROR: Check your configuration as your refresh_token may be empty or invalid. You may need to issue a --logout and re-authorise this client.
@abraunegg
Copy link
Owner

@Orbocom
OK .. that is an issue, as, the Docker switches are missing a logout option. This needs to be fixed.

Additionally - you have this:

resync = true

Do not do this. What this means is every time your Docker container starts you are deleting your local sync state and performing a clean sync. There is no need to do this unless the application tells you to run --resync you you really want to perform this action.

@abraunegg abraunegg added Bug Something isn't working Investigating labels Dec 16, 2020
@abraunegg
Copy link
Owner

@Orbocom

Please can you test the following PR:

git clone https://github.com/abraunegg/onedrive.git
cd onedrive
git fetch origin pull/1187/head:pr1187
git checkout pr1187
./configure; make clean; make;

When running the PR, your version should be: onedrive v2.4.8-7-g029998e

As you are running Docker, you will need to manually rebuild your Docker container using this PR. Use ONEDRIVE_LOGOUT=1 as part of your Docker run / restart to enact the --logout

Usage Example:

docker container run -e ONEDRIVE_LOGOUT=1 -v onedrive_conf:/onedrive/conf -v "${onedriveDir}:/onedrive/data" driveone/onedrive:latest

If you can test and provide feedback that would be greatly appreciated.

@abraunegg abraunegg changed the title No Logout No Logout possible when using a Docker container Dec 16, 2020
@Orbocom
Copy link
Author

Orbocom commented Dec 17, 2020

@abraunegg

Thank you for your quick response; highly appreciated!
May take a few days for me to provide you feedback on the mentioned above.

@abraunegg
Copy link
Owner

@Orbocom

Any update in testing this PR?

@Orbocom
Copy link
Author

Orbocom commented Dec 19, 2020 via email

@Orbocom
Copy link
Author

Orbocom commented Dec 20, 2020

@abraunegg

Hope this provides you with some usable output

Compiling seemed to work in the correct way.

The "docker build" process caused errors (see bottom of log); no idea how to resolve this.

Docker build Log Output

kees@kees-pc:~$ docker build /home/kees/onedrive/contrib/docker
Sending build context to Docker daemon  12.29kB
Step 1/11 : FROM debian:stretch
stretch: Pulling from library/debian
22f9b9782fc3: Pull complete
Digest: sha256:49c93d2ea3d40a86c1f69793cfff65dd55fbf587401243ebba0e40b260ec9a0c
Status: Downloaded newer image for debian:stretch
 ---> f9d06e40f53a
Step 2/11 : RUN apt update &&     apt install -y build-essential curl libcurl4-openssl-dev libsqlite3-dev pkg-config git wget
 ---> Running in ad4be0dee0c4

//

2020-12-20 15:40:03 (3.56 MB/s) - '/tmp/dmd_amd64.deb' saved [15021956/15021956]

Selecting previously unselected package dmd.
(Reading database ... 16852 files and directories currently installed.)
Preparing to unpack /tmp/dmd_amd64.deb ...
Unpacking dmd (2.092.1-0) ...
Setting up dmd (2.092.1-0) ...
Processing triggers for shared-mime-info (1.8-1+deb9u1) ...
Removing intermediate container 0f11ce89929c
 ---> 03f05c9b9041
Step 4/11 : RUN rm -f /tmp/dmd_amd64.deb
 ---> Running in bc9a93936f91
Removing intermediate container bc9a93936f91
 ---> f429fe9593b5
Step 5/11 : COPY . /usr/src/onedrive
 ---> 7ac1b5c39653
Step 6/11 : RUN cd /usr/src/onedrive/ &&     ./configure &&     make clean &&     make &&     make install
 ---> Running in adc42791aa58
**/bin/sh: 1: ./configure: not found**
**The command '/bin/sh -c cd /usr/src/onedrive/ &&     ./configure &&     make clean &&     make &&     make install' returned a non-zero code: 127**

@abraunegg
Copy link
Owner

@Orbocom

Unsure. It looks like the build process is not pulling in the correct requirements.

What I will do is push this to 'master', you should then just be able to rebuild your client without issue by pulling down the latest image and re-testing that way.

@abraunegg
Copy link
Owner

This is now merged, to you will be able to test the 'latest' Docker image once they have rebuilt - usually within the next 30 mins.

@Orbocom
Copy link
Author

Orbocom commented Dec 21, 2020

@abraunegg

Pulled the updated image and ran the container.
Logout seems to be successful
However, container immediately exits, also when starting manually

@Orbocom
Copy link
Author

Orbocom commented Dec 21, 2020

kees@kees-pc:~$ docker pull driveone/onedrive:latest
latest: Pulling from driveone/onedrive
2d473b07cdd5: Pull complete 
3cc7738a7dec: Pull complete 
a418b9e13150: Pull complete 
e9cf60bc931f: Pull complete 
4e16c564b7ba: Pull complete 
0223df11132f: Pull complete 
Digest: sha256:7110143e492974cabacc4c878d1446105ecccd369f15f2fff3cc9ee567bf3576
Status: Downloaded newer image for driveone/onedrive:latest
docker.io/driveone/onedrive:latest
kees@kees-pc:~$ onedriveDir="${HOME}/OneDrive"
kees@kees-pc:~$ docker container run -e ONEDRIVE_LOGOUT=1 -v onedrive_conf:/onedrive/conf -v "${onedriveDir}:/onedrive/data" driveone/onedrive:latest
++ stat /onedrive/data -c %u
+ : 1000
++ stat /onedrive/data -c %g
+ : 1000
++ getent group 1000
+ odgroup=
+ odgroup=onedrive
+ groupadd onedrive -g 1000
++ getent passwd 1000
+ oduser=
+ oduser=onedrive
+ useradd -m onedrive -u 1000 -g 1000
+ chown onedrive:onedrive /onedrive/ /onedrive/conf
+ ARGS=(--monitor --confdir /onedrive/conf --syncdir /onedrive/data)
+ '[' 0 == 1 ']'
+ '[' 0 == 1 ']'
+ '[' 0 == 1 ']'
+ '[' 0 == 1 ']'
+ '[' 0 == 1 ']'
+ '[' 1 == 1 ']'
+ echo '# We are logging out to perform a reauthentication'
+ ARGS=(--logout ${ARGS[@]})
# We are logging out to perform a reauthentication
+ '[' 0 -gt 0 ']'
+ exec gosu onedrive /usr/local/bin/onedrive --logout --monitor --confdir /onedrive/conf --syncdir /onedrive/data
Configuration file successfully loaded
config file has been updated, checking if --resync needed
An application configuration change has been detected where a --resync is required

@Orbocom
Copy link
Author

Orbocom commented Dec 21, 2020

kees@kees-pc:~$ docker container start onedrive
onedrive
kees@kees-pc:~$ docker container ls -a
CONTAINER ID   IMAGE                      COMMAND            CREATED         STATUS                     PORTS                                            NAMES
05590ba41157   driveone/onedrive:latest   "/entrypoint.sh"   9 minutes ago   Exited (1) 4 seconds ago                                                    onedrive

@Orbocom
Copy link
Author

Orbocom commented Dec 21, 2020

Sorry for the mess.

@abraunegg
Copy link
Owner

@Orbocom

Configuration file successfully loaded
config file has been updated, checking if --resync needed
An application configuration change has been detected where a --resync is required

This tells me you need to use also --resync as your configuration file has changed. If you have already successfully re-authenticated, you need to restart your Docker container with:

docker container run -e ONEDRIVE_RESYNC=1 -v onedrive_conf:/onedrive/conf -v "${onedriveDir}:/onedrive/data" driveone/onedrive:latest

If not, you need to start it with:

docker container run -e ONEDRIVE_LOGOUT=1 ONEDRIVE_RESYNC=1 -v onedrive_conf:/onedrive/conf -v "${onedriveDir}:/onedrive/data" driveone/onedrive:latest

Please read the Docker usage document for more details.

@abraunegg
Copy link
Owner

Closing issue as PR merged into 'master', and original issue fixed

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working Fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants