Canada. My understanding was that green card holders get social security, but non permanent residents don't, no matter how many years they've been working in the states. But if in fact the visa status at time of working or time of collection doesn't matter, then that would be welcome news indeed.
Also the Canadian version of SS is a sliding scale based on how many years you paid into it, I implicitly assumed it's the same for the US but only now realized that might not be the case.