Fitting a brewer's airlock into the lid of a Mason jar is another quick and easy modification that turns the jar into a fermentation chamber. The airlock is a little plastic device with a volume of water in it, such that CO2 can pass out through it, but no air can come back in. This lets you set your pickles, beer, or whatnot to fermenting and allows them to emit carbon dioxide smoothly without letting in outside contamination.
Also on these boards
How To Turn A Mason Jar Into A Fermenting Crock -- To DIY a very serviceable lacto-fermentation crock, you will need: 1 airlock, 1 rubber stopper #6 is a good size, 1 reCAP Mason Jar Cap, 1 Mason jar in an appropriate size to hold your ferment. Need to look into lacto fermentation some more. Maybe this will be foot for some mash ;)