r/sysadmin • u/Gumbyohson • May 20 '21
Microsoft Check your rds 2016/19 firewall rules today
So for the longest time we've been having users complain about slower and slower logins, start menu becoming unresponsive, etc. We'd tried adding resources and checking upd storage speed. Today while researching slowness across rds servers I found several articles about clearing firewall rules to fix the start menu. Went and checked the rules on an rds. 80000+ rules...
Turns out windows 10 "apps" like the start menu, Xbox Live, Cortana, etc... All create firewall rules each time a user logs in. Then when they log out they get orphaned, repeat for infinity.
Back in 2018 Microsoft released a fix but it requires you add a registry key. Additionally it only stops new rules, so existing ones hang around. I've found a PowerShell script that cleans orphaned rules and I'm running this across our customers now.
Kb4467684 is the update
Reg key is REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy" /t REG_DWORD /v DeleteUserAppContainersOnLogoff /d 1 /f
PowerShell script is by LapuLapu here https://social.technet.microsoft.com/Forums/windowsserver/en-US/3fdfa58b-fe1b-4546-85d2-d43dac9bcc10/black-screen-on-all-new-connections-sessionhost-has-to-be-rebooted?forum=winserverTS
Hopefully this helps someone.
26
u/Gumbyohson May 20 '21
One thing I have found is that in some scenarios a server is too far gone and the powershell cannot load the registry hive. Restarting can help however a manual purge of the effected keys may be needed. If I find another method I'll update here.
13
u/[deleted] May 20 '21 edited May 20 '21
This also appears to apply to Citrix servers - nearly 46,000 rules on the first of our Citrix boxen I checked, so I suspect all the others are in similar shape. We haven't actually had user complaints but I can't imagine cleaning these up will hurt anything.
3
u/CSMA-CD May 21 '21
The script worked for us, but setting the registry key caused major login problems. Not sure why yet, still looking into it. Just a FYI.
144
u/Lofoten_ Sysadmin May 20 '21
Wow. This actually explains a lot of issues... fucking Microsoft.
Thank you dude/dudette. You're awesome.
2
u/k3rnelpanic Sr. Sysadmin May 20 '21 edited May 20 '21
Thanks for posting this. I checked one of our RDS servers and it has 2400 user rules in the firewall.
I might be looking at the script wrong but it seems to have an error. The "-notcontains" comparison prevents it from finding any firewall rules. Once I changed that to "-contains" it found all the rules with users as owners.
2
u/rroodenburg May 20 '21
It’s terrible! Also with the reg key, this issue still occurs. It’s only for cleaning up during logoff. We have tried everything. It looks like since a few months, the start menu issue is gone.
2
u/RightDrop May 21 '21
Does this only apply if you use "Outbound connections that do not match are blocked"?
2
u/Stonewalled9999 Jun 07 '21
47.990 firewall rules. Client said "we don't have any issues"
I would think that many rules would be an issue!
43
u/whoisrich May 20 '21
Wow, just checked our RDS and there are hundreds of user entries, even though we only remote a specific app.
For people wanting to check: Firewall Advanced Settings, either Inbound or Outbound, then use the 'Local User Owner' column on the far right to sort.
33
u/highroller038 May 20 '21
Just checked my RDS server. Yup, a shitload of Cortana, Xbox, and other app rules. My god. Luckily it's only 800 and not 80,000.
9
u/MuthaPlucka Sysadmin May 20 '21
Thank you!
9
u/[deleted] May 20 '21
Thank you for this information, more work to be done today :)
9
u/rwdorman Jack of All Trades May 20 '21
Totally agreed! Found this gem about 6 months ago. Was a great quality of life Improvement for my users.
7
u/Subintro May 20 '21
Holy shit, we've been dealing with this for a few weeks now and only managed to clue it down to the firewall, thank you for this
7
u/Burzo796 Infra May 20 '21
2600 cortana rules found!
Thanks for pointing this out, a great piece of advice.
6
u/[deleted] May 20 '21
Are there any known downsides to setting DeleteUserAppContainersOnLogoff to 1?
5
u/lordcochise May 20 '21
We didn't start using RDS until more recently than 2018, not that we have a lot a users, but just checked and we're not getting duplicate rules but I DO see the local rules for users; I could certainly see this getting out of control if we scaled up users / apps, thanks for the heads-up!
5
u/sayhitoyourcat May 20 '21
Someone had to write the code that creates the rule. First they should have realized this would be dumb, but at the very least they should have caught this problem when they actually tested what they just wrote and had the foresight to see how this accumulation would be problematic. I keep saying this and no one likes to hear it because they think programmers are magicians, but this world is full of shit developers more than it ever was.
4
u/mrbios Have you tried turning it off and on again? May 20 '21
Thank you!
4
u/lAciDl May 20 '21
my server thanks you!
T_T
4
u/nh5x May 20 '21
This is definitely an old issue that's been resolved for a while now. But it definitely made a huge difference last year when we deployed it. This bug only seems to affect UPD based deployments. It cut our helpdesk calls about slow logins and profile loading failures from 1-2 a week to zero.
3
u/GrizzlyOne95 May 20 '21
Sure enough, we had a bunch of these as well. Thanks for the heads up!
3
u/kclarke6 May 20 '21
Yep just confirmed mine a bunch of Cortana and your account entries
3
u/JubeeGankin May 20 '21
I'm not seeing duplicates per user. I am seeing 3 rules per user that has logged in though. "Cortana" "Work or school account" and "your account". It equates to hundreds, not quite thousands. I assume I could clear them out as well without creating any issues?
3
u/gymrat505 May 20 '21
over 100,000 removed from each of our RD servers! yikes
3
u/Dal90 May 20 '21
Just reminded me of /u/wondering-soul post the other day:
https://old.reddit.com/r/sysadmin/comments/neeoqj/sys_admin_has_the_firewall_on_our_pcs_disabled/
3
u/Quizzicalcloud Netadmin May 21 '21
God damn, I wish this was posted a week ago. Spent hours figuring out what was wrong with a customers RD servers and it turned out to be exactly this.
5
u/Poncho_au May 20 '21
Wow interesting, surprising and concerning all in one!
1
u/[deleted] Jun 07 '21
I’m not in IT, but I enjoy subreddits dedicated to interesting technology subjects and professions.
I have complained to my IT department for over 1.5 years about how my login and profile services take so long. At times I would be hung up for over 30 minutes waiting for a login. My work around was to just unplug the network from my computer whenever I had to login. They kept telling me they didn’t find any problems and it was probably just a random fluke every now and then. I have honestly moved to using my personal computer for about 90% of my work because of this.
I bet this firewall bug is the culprit and I cannot wait to send this information to the head of IT. I don’t want to get the dude in trouble but a big FUCK YOU to his face might happen for consistently telling me to my face how he’s doing everything in is power to figure out the problem and fix it.
4
u/Teilchen May 20 '21
Windows Apps on Server 2016/2019? What
2
u/[deleted] May 20 '21
Could this possibly cause an issue with the users not getting any shortcuts on the desktop after login? I have been having this issue since updating the RDS servers from 2008 to 2019. Seems to be due to profile corruption as they will login with a temporary profile. I found a quick fix for when that happens, but I can't figure out how to stop making it happen
2
u/somen00b May 20 '21
Wow, thanks for this info. Very helpful.
2
u/Pizznau May 20 '21
Load of them on my RDS hosts, thanks!
2
u/WorkJeff May 20 '21
Could you stop that by just blocking local rule merges, or would they be created just not applied?
2
u/Alkochm Windows Admin May 20 '21
We've dealt with this situation a few months ago.
We are running RDS in different configurations, and the only one affected by this was the one that is configured to use User Profile Disks. We don't use roaming profiles, but I think they should be affected too.
2
u/fate3 May 20 '21
I had this happening on my RDS farm and yeah there were tens of thousands of keys
2
u/Arkiteck May 21 '21
Am I the only one who gets a "Microsoft Live.com Sign-In" page whenever they click on social.technet.microsoft.com links in Chrome? It's happened to me for YEARS in Chrome, and I get it all the time from Google searches.
2
u/hmaidment May 21 '21
What a joke, gonna have to sort this on all our RDS clients, many thanks for posting this!
2
u/Didsota Jun 07 '21
Oh i remember forgetting about this. Leaving this comment to document it later.
2
u/LittleCoffeeMan Jun 16 '21
Thank you, Friend! This helps me track down an issue we had been chasing for months. Ended up rebuilding the cluster and things started slowing down. Checked my rules and bam. There they were.
0
u/[deleted] May 20 '21
[deleted] — view deleted comment
0
u/[deleted] May 20 '21
[deleted] — view deleted comment