means that
it is easier to prevent a harmful influence from entering one's life than to remove it later.
The administrator introduced security checks before granting access to the network. Better keep the devil at the door than turn him out of the house.