Backport internal and client port hardening to 3.7.x
Add missing files to backport