Too late to help you my friend but I think I may have discovered the "secret" ....if there truly is one..to doing ports.
The last 3 recon missions I got I didn't actually go directly into port. That is either suicide or at least a couple of hours of drudgery,slipping and sliding along the shallows.
I've found that you can take your boat in very close to a port by easing up to it from outside , submerged, and parallel to the land mass. Most times while staying at least in the light blue shaded sea areas which are usually a couple of hundred feet deep..and avoid the white shaded shallows.
Anyway it has worked for me 3 times in a row. I got excellent views of the harbors each time and the ships at anchor...and avoided any hostile vessels...it was like peacetime steaming.
But it does go without saying that this way kills all the suspense of harbor misisons or just crusing and looking....and maybe that is what one wants after all...but if you want to play it safe...