dchristl / macless-haystack

Create your own AirTag with OpenHaystack, but without the need to own an Apple device
GNU General Public License v3.0
408 stars 66 forks source link

Linux support #12

Closed mrx23dot closed 1 year ago

mrx23dot commented 1 year ago

Can I run it on linux, since WSL is supported?

Is it likely that apple changes the appleID protocol which would break compatibility? Or that rarely changes and this project only uses a subset of functions anyway.

dchristl commented 1 year ago

Hello @mrx23dot,

Can I run it on linux, since WSL is supported?

What do you mean by Linux support? The core technology is docker which runs native on Linux. Only if you have Windows you have to use WSL to start a Linux system for Docker.

Is it likely that apple changes the appleID protocol which would break compatibility? Or that rarely changes and this project only uses a subset of functions anyway.

If this changes all selled Airtags will not work anymore.

mrx23dot commented 1 year ago

Do you mean with docker on linux I don't need any Mac to try the system out?

dchristl commented 1 year ago

No, you need Docker to run a virtual Mac. Because the Mac runs inside the Docker container.

mrx23dot commented 1 year ago

ahh I see, thanks!

mrx23dot commented 1 year ago

is MAC really needed? code says it connects to apple server, so it shouldn't matter where from, as long as we have apple access token, not sure if that rotates or not:

        conn = six.moves.http_client.HTTPSConnection('gateway.icloud.com', timeout=5, context=ssl._create_unverified_context())
        conn.request("POST", "/acsnservice/fetch", data, request_headers)
dchristl commented 1 year ago

Yes, it is because you need a one time password for the webservice. This one is only in the Apple keychain, rfreshes randomly and the algorithm behind is not reversed engineered. I will be happy to throw away the virtual machine and run this on one a Raspberry or in a cloud.

mrx23dot commented 1 year ago

I see, so the OTP can change any time, one solution would be running a REST server on linux and updating the OTP manually via an endpoint when needed.

dchristl commented 1 year ago

I don't see any advantage in manually updating this token in random timespans. Sometimes the webserver breaks and you have to start your VM/Emulator to get a new OTP and copy this manually to the Linux server.

mrx23dot commented 1 year ago

docker image is 18GB, is there any other way to get the auth token?

"The oldest operating system version that supports iCloud services is OS X Lion (10.7) for Mac computers and iOS 5 for iOS devices." OS X Lion takes 5GB

dchristl commented 1 year ago

I think this will work with older versions, too. But you have to install it for yourself. There is no older preinstalled docker image available.

mrx23dot commented 1 year ago

I installed the docker image from the instruction to the debian, but constantly says:

...
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize ADC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize ADC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
audio: Failed to create voice `adc'
gtk initialization failed
/usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub"
ssh: connect to host 127.0.0.1 port 10022: Connection refused
Disk is being copied between layers. Repeating until able to copy SSH key into OSX...
/usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub"
ssh: connect to host 127.0.0.1 port 10022: Connection refused
Disk is being copied between layers. Repeating until able to copy SSH key into OSX...
/usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub"
ssh: connect to host 127.0.0.1 port 10022: Connection refused
Disk is being copied between layers. Repeating until able to copy SSH key into OSX...
/usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub"
ssh: connect to host 127.0.0.1 port 10022: Connection refused

repeats

even after 24hrs

dchristl commented 1 year ago

It seems your problem is

gtk initialization failed

Check out this issue on sickcodes, maybe you get some hints to solve this. Look at the first answer of sickcodes.