How to make soldermask on PCBs for soldering?
Solder mask uses a special kind of paint. It cures (hardens / dries) using UV light.

The paint is applied to the entire board, then a printed mask is applied over the top. This mask has the parts that you want open in black and the parts that you want covered in paint transparent.

The paint is then dried in an oven and cured with UV and the mask removed.

Where the mask was opaque the paint will not have cured and can be washed off with a suitable solvent.

You can buy the paint on eBay in syringes. If you are careful it is also possible to apply the paint with a very fine paint brush leaving the apertures you need clear. Then bake it at 80C until dry and leave it sat in bright sun for 30 minute's or so.