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

Anydesk cannot connect to Anydesk relay server #59

Open
2 tasks done
Delapro opened this issue Sep 25, 2023 · 6 comments
Open
2 tasks done

Anydesk cannot connect to Anydesk relay server #59

Delapro opened this issue Sep 25, 2023 · 6 comments
Labels
enhancement improvements to existing features or functionality

Comments

@Delapro
Copy link

Delapro commented Sep 25, 2023

Checklist

  • I looked at https://github.com/PhoenixPE/PhoenixPE/wiki/FAQ to see if my question has already been answered.
  • I performed a search in the issue tracker for similar issues using keywords relevant to my problem, such as the error message I got from the log.

Report



Describe what is happening
I built a PhoenixPE ISO with Anydesk selected. After booting I started Anydesk. But Anydesk cannot connect to the Anydesk relay server. Network connection is available I can ping and tracert sites on the internet. I also can ping boot.net.anydesk.com, the standard Anydesk relay server address without problems. But Anydesk doesn't get an address and cannot connect to the anydesk server.

To Reproduce

  1. Build PhoenixPE with Anydesk selected
  2. Boot created PhoenixPE
  3. Wait/Establish internet connection
  4. Start Anydesk
  5. See Error

Expected behavior
After starting Anydesk it should connect to the Anydesk relay server.

Screenshots/Logs
image

@Delapro
Copy link
Author

Delapro commented Sep 26, 2023

As I found out by accident, when the created PE ist running for a longer time, I finally get the connection and remote access via Anydesk is possible! Every 3-90 seconds, its random, Anydesk tries to connect to the relay server. Waiting for a longer time it suddenly gets the connection. I have to further investigate this if the time it takes to connect is maybe constant.

@Delapro
Copy link
Author

Delapro commented Sep 28, 2023

OK, I can confirm now. After booting PE and starting Anydesk it always takes one hour and then Anydesk is able to connect to the Anydesk relay server. After that time period I can restart Anydesk as often I want, it always connects instantly to the Anydesk network. If I reboot the machine I have to wait one hour again.

The question is now, what is responsible for this strange behaviour? Anydesk or the built PE?

@homes32
Copy link
Contributor

homes32 commented Sep 29, 2023

Sometime back in July? Anydesk changed it's behavior and requires an ssl certificate for authentication. once you have logged into your anydesk account, an client certificate and private key are are stored in %AppData%\AnyDesk\service.conf.

if you copy this file to your build Anydesk should start instantly.

To test, edit the Anydesk script and paste the following code

System,GetEnv,"APPDATA",%HostAppData%
If,ExistFile,"%HostAppData%\AnyDesk\service.conf",FileCopy,"%HostAppData%\AnyDesk\service.conf","%TargetAppData%\AnyDesk\service.conf"

under

///////////////////////////////////////////////////////////////////////////////////
// Settings

I'm looking to see if there is a more elegant solution then copying the certificate from the host, but I'll eventually get this script updated. :)

homes32 added a commit that referenced this issue Sep 30, 2023
…cal users profile (Issue #59)

- Additional options for including settings or files from a user defined location
@homes32 homes32 added the enhancement improvements to existing features or functionality label Sep 30, 2023
@Delapro
Copy link
Author

Delapro commented Oct 20, 2023

I haven't tried the way to copy the certificate, because it is not always feasible to rely an a previous installed Anydesk. Especially in forensic or catastrophic situations it is necessary to interact as less as possible with the target system.

But after investigating the subject further I can tell that the problem comes from the timezone of the created WinPE. If I run "tzutil /g" it shows "W. Europe Standard Time" but with the appendix "_dstoff", hence daylightsavingtime known as summertime is not set correctly.

The problem seems to be a well known problem with PE: https://forum.acronis.com/forum/acronis-true-image-home-forum-older-versions/using-winpe-image-hard-disk-important.

So if I run

.\tzutil /s "W. Europe Standard Time"
sc start w32time
.\w32tm.exe /resync

after booting into PE, "tzutil /g" shows no "_dstoff" appendix anymore and then starting Anydesk it connects instantly.

I'm currently playing with PhoenixPE to extent it and to add tzutil.exe and w32tm.exe to PhoenixPE. Do you accept a pullrequest, if I get it done?

@Delapro
Copy link
Author

Delapro commented Oct 30, 2023

One more thing, the problem is currently solved until March, 31 of 2024. Because now daylightsaving time (summertime) is over :-)

@homes32
Copy link
Contributor

homes32 commented Oct 31, 2023

Thanks for all your investigation into this issue. I have been able to verify your findings and decoding the certificates AnyDesk generates also confirms that the "valid from" attribute is behind an hour, causing the cert to be invalid until time has elapsed.

I have been playing with some enhancements to the localization script. It is possible to auto set DST, but it has consequences (https://learn.microsoft.com/en-us/archive/blogs/winpe/daylight-savings-time-in-winpe) such that it can end up causing WinPE to set the BIOS clock backwards every reboot for a period after the fall transition.

Also experimenting with syncing the clock once a network connection is established. It works, but there have been some inconsistent behavior that I'm trying to work out to make it reliable.

I have attached a dev snapshot of the script if you want to experiment further.
Localization-dev.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improvements to existing features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants