It was required. They had to be lit at night, with all markings lit at all times. They could not sail as part of a convoy as this would strip them of the protection of the red cross and make them targets.
It didn't stop all sub commanders from taking a shot at them, but if they did, and suvived the the war, then they got a short drop with a sudden stop