Quick search by citation:

22 U.S. Code § 451 - Submarines and armed merchant vessels

Whenever, during any war in which the United States is neutral, the President shall find that special restrictions placed on the use of the ports and territorial waters of the United States by the submarines or armed merchant vessels of a foreign state will serve to maintain peace between the United States and foreign states, or to protect the commercial interests of the United States and its citizens, or to promote the security of the United States, and shall make proclamation thereof, it shall thereafter be unlawful for any such submarine or armed merchant vessel to enter a port or the territorial waters of the United States or to depart therefrom, except under such conditions and subject to such limitations as the President may prescribe. Whenever, in his judgment, the conditions which have caused him to issue his proclamation have ceased to exist, he shall revoke his proclamation and the provisions of this section shall thereupon cease to apply, except as to offenses committed prior to such revocation.

(Nov. 4, 1939, ch. 2, § 11, 54 Stat. 9.)
Executive Documents
Use of United States Ports and Territorial Waters by Submarines of Foreign Nations

By Proc. Nos. 2375, Nov. 4, 1939, 4 F.R. 4494, 54 Stat. 2672; 2400, Apr. 25, 1940, 5 F.R. 1570, 54 Stat. 2699; 2406, May 11, 1940, 5 F.R. 1690, 54 Stat. 2705; 2409, June 10, 1940, 5 F.R. 2192, 54 Stat. 2707; 2445, Nov. 15, 1940, 5 F.R. 4524, 54 Stat. 2672, submarines of France, Germany, Poland, United Kingdom, India, Australia, Canada, New Zealand, Union of South Africa, Norway, Belgium, the Netherlands, Italy, and Greece were denied use of United States ports and territorial waters.