Juido wrote:i did and i found something what appears to be a bug.
Condition 1 has trouble with the ssid = Jui@2,4ghz , especially with the comma, because ssid Jui@24ghz or Jui@2.4ghz work fine.
same false result with ssid = test,test
since my phone displays the ssid correct and is able to connect, i suppose the bug is on automagic's side to handle ssids that contains a comma
I answer the comma problem first, since it is shorter. Yes, that is a semi bug (probably we can call like that), since automagic SSID list use comma to separate SSIDs. So if the SSID contain a comma, it will treated as two SSID. So "Jui@2,4ghz", will be parsed by the condition as check if "Jui@2" or "4ghz" exists.
Ugly work around is change the wifi name to have no comma, which is impossible to do with public wifi. The correct solution is to double quote the variable {ssid}. So you have to put in as
This way, the {ssid} will be evaluated once only, not treated as separate 2 SSID. Try it out. I don't know about this semi bug until you encounter it. There are still other trigger/action/condition, which utilize the similiar method to separate list of choices; most of them need to be done this way too (if there is comma). I don't think this will be fixed, since it is the way automagic handle the SSID variable. But maybe need to put extra note at the help to put Double quote for SSID with comma.
thats not what i meant..
i only connect to Y, but Z has the stronger signal
and help text for "Wifi available" says that the variables of the scan depends on the strongest signal available.
so i hope that wont be the case since we use the {ssid}
Y and Z has the same SSID? If yes, then you will have problem. If no, then it is working fine. The help text for "highest signal strength" apply only for AP (BSSID) with the same wifi name (SSID) we have defined in the option. As long as we are using the {ssid} variable as the scan option, then it will always pick up the current connected one.
This is my test. I have 3 wifi AP here, AP 1 and AP 2 has the same SSID, but of course different BSSID. AP 3 is wifi hotspot from my other phone, set to Open security. SSID name and BSSID are just examples.
AP 1 = SSID : ABC, BSSID : 00:00:00:AA:BB:01, signal : -55 dBm (3 bar)
AP 2 = SSID : ABC, BSSID : 00:00:00:AA:BB:02, signal : -70 dBm (2 bar)
AP 3 = SSID : XYZ, BSSID : 00:00:00:DD:EE:03, signal : -15 dBm (4 bar)
I am now connected to
AP 1. I then manually switch to
AP 3 (XYZ), the wifi available dialog will show me the info from the
AP 3, BSSID : 00:00:00:DD:EE:03, signal -15 dBm, which is correct. Since it has different ssid, and you maybe say it is the strongest currently (my phone literally kiss the tether phone
).
So to test the "highest signal strength" statement, whether it is still searching for the strongest available even though we have put {ssid} in the option; I now switch from
AP 3 to
AP 1 again. If the "highest signal strength" statement always search for strongest regardless of {ssid} we put in, then I should still get the info from
AP 3. But when I switch to
AP 1, it shows me all the info from
AP 1, BSSID : 00:00:00:AA:BB:01, signal : -55 dBm. Even though the signal from
AP 3 still -15 dBm. So,
if we use it in this case (by retrieving {ssid} from the trigger) the "highest signal strength" statement refers to the strongest from the same SSID that I use to connect.
But if I fill in manually SSID
ABC,
XYZ (both SSID), not using {ssid}, and execute the flow manually; yes it will always show the strongest, which is
AP 3 XYZ, -15 dBm. Even though I am currently connected to
AP 1 ABC.
So to get info only from current connected one, we must use the {ssid} from the trigger. Or if we need to use it inside flow with other trigger, we can get the {ssid} from
Condition : Wifi connected. That's the same result, just the difference between event (trigger) and state (condition). The trigger only happen once (when connected), the condition can be checked for a period of time (while connected).
Same SSID
The problem arise when we have same SSID from different BSSID. When I roam around from
AP 1 to
AP 2, sometimes it change the info perfectly, directly show info from
AP 2. But it often show 2 disconnect/reconnect (debug dialog appear twice), before showing the correct info from
AP 2. I confirm the connected AP using wifi 360 overview. I don't know how android handle same SSID, but it seems my phone report randomly when the signal from
AP 1 too low and switch to
AP 2. Can't see any pattern, but mostly it switch when the signal is below 2 bar. That's the problem I still don't know how to solve.
Since you only need different SSID separation to activate VPN, this should not give you problem (ideally). If same SSID, one of them is protected, the other should have been configured as protected as well, to ensure roaming. The wifi capabilities should have "
WPA" in all BSSID. Only when you change SSID, the capabilities will change, and it works properly with this flow (as long as you use the {ssid}).
Security Issue
However, in real world, there are other problem as well. If I know the public wifi password, which is usually easy to get it from the receptionist or waiter/waitress; I can just setup my portable wifi hotspot in the middle of the crowd, with the same SSID and same password. Because I made it the same, all device that used to connect to that secured wifi, can connect to mine as well. Other clients will never know that they have connected to my rogue wifi hotspot, since the SSID and password match. I can run wireshark/wi.cap and log all unencrypted traffic (non-https) from all connected client. They won't know I am logging the data, no certificate error warning shown. Everyone can set this up, but only the one who understand networking can read the log.
A good setup of multiple wifi, usually include rogue wifi detection as well. But this can easily avoided by changing the mac to one of the AP.
The other way around, I can just simply connect to the same wifi and perform MITM to neighbor client. But usually in public wifi, this has been mitigated by AP isolation. And MITM will generate error certificate warning to https site, so less practical. Creating rogue wifi hotspot is easier.
TLDR version :
Treat all wifi as hostile, except the one we manage (because we mostly don't tell our password everywhere)
Well, it is not happening everyday. Most of the time, generally a WPA secured wifi is far more secure than open wifi. But if you concern until wanna use VPN, I believe you concern also about these possible security hole. So that we don't fall into false sense of security (believing all WPA secured wifi is safe), which is far more dangerous than not setting up any protection at all (because we can be more careful). It means all other wifi outside of our own managed one should be treated as not secure. You should activate VPN even they are WPA secured.
Simplified flow
If that is the case, then the flow will be simplified a lot. Just need to check if we are connected to our own wifi (or list of whitelisted wifi). If not (false), then activate VPN. No need to check the capabilities anymore.
Additional check
If you want more secure, you can add additional check to the BSSID, to make sure it is the correct AP station, not the rogue one (less likely since we don't give our password freely). Another additional setup will be to use Https request to check for certificate error. You can still add..... Well, this can goes even further
. I don't why I can't stop typing