What ports does iCloud and iMessage use and is it possible to use SSH port forwarding via a proxy to use them on a network that blocks the services?
3 Answers
According to: http://support.apple.com/en-us/HT202078
| Ports |FaceTime | iMessage|
| 80 (TCP) | ✓ | ✓ |
| 443 (TCP) | ✓ | ✓ |
| 3478 through 3497 (UDP) | ✓ | - |
| 5223 (TCP) | ✓ | ✓ |
| 16384 through 16387 (UDP) | ✓ | - |
| 16393 through 16402 (UDP) | ✓ | - |
Which means 80, 443, and 5223
That being said I have YET to actually tunnel iMessage correctly
So I think i've found a way to accomplish this (however) its more of an idea right now than a reality.
The concept would be to stand up a socks ssh proxy ssh HOST -D 1080
and then write a custom proxy.pac
file that routes specific sties through this socks connection
Directions on how to write one of these proxy things are here: https://mikewest.org/2007/01/auto-configuring-proxy-settings-with-a-pac-file
If i ever make progress i will update this answer.
They are permitting SSH outbound but not iMessage? Given the ports you have listed above, you would need to do something like this.
Outside of work: Force kill Messages. Set up a tcpdump or Wireshark listening to UDP 53 to read what hosts Messages is attempting to resolve and connect to.
This can kind of be duplicated by looking at the output of the lsof -i TCP
, but the lsof shows the hostnames resolved by IP, not the IPs resolved by hostnames, which might be different.
Now, make host entries in /etc/hosts (or mess around with DNSMASQ, whatever), for every host that Messages attempts to connect to. Point them at 127.0.0.1.
127.0.0.1 imessages.host.whatever.apple.com
If Messages requires you to connect to multiple servers, you may need to make multiple subinterfaces for Lo
, like lo.1
and give them 127.0.0.2-X
addresses.
Now do the ssh. You will need to be root because you are listening on ports 80 and 443.
ssh myremoteserver.com -L80:127.0.0.1:remoteserver -L443:127.0.0.1:remoteserver -L5223:127.0.0.1:remoteserver