I have my Linux server set to block all ports except those I actively use. It works, but I'm having trouble with Stash. I've tried freeing 20-22 outgoing, 80, 1443, 9418 all incoming and outgoing, along with the http port and control port I use for my setup incoming and outgoing. Those are the only ports I've seen show up using iptraf.
I am able to connect to my server and Stash from my PC. I can login, it calculates what's needed for the push and begins to perform the push, actually sends all of the content, but then it fails after a long timeout with the message:
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://xyz@www.abc.org:####/scm/repo/repo.git'
If I go in and unblock all of the ports, then it works properly and completes the push like normal. I can't figure out what port it's using.
Thank you in advance for your help. 
Best regards,
Rick C. Hodgin