Light- and vapor-tight enclosure entry
Theses are called cable glands in much of the world, in the US they're called cable connectors. Here is an exploded diagram from this website. 



The "Pressure Dome" squeezes the (incompressible) sealing sleeve so that it deforms and presses against the wire, forming a seal, and simultaneously the pressure fingers squeeze the cable insulation forming a strain relief. 

This kind of thing will only work well if the cable is more-or-less round. If it's a "Zip cord" construction, I don't hold out high hopes for the seal being good. 

Similar products (usually made of metal rather than plastic, and possibly with high-temperature seals such as silicone rubber) are available to seal against tubing. 

Edit: 

If you can't get the cable through the parts, there are "split" types available that snap over the cable.