Vaseline will work, silicone grease is even better. Use either - not just on rear lights also on anything thats electrical and has any means for liquid to get in. That way all lights are waterproof.
I just use a tiny smear of silicone grease round the joint and have twice had a Smart rear lighht (notorious for water problems) carry on flashing while underwater in a puddle, then carry on working on the bike after being rescued.
Shows I'm silly - it was the same puddle in the same place but on different days - one of my usual parking spots, where I seem to regularly drop things as I take them off the bike while it's left.