They are not only legal, they are expected. More often than not each team has at least one player known for brawling. Mostly this is a defense man, who is trained at boxing. I’m not making this up. Occasionally the fights are organic and spontaneous, but just as often they are called from the bench. A fight is an effective way to slow the pace of a game, to teach the other team that they are being excessively violent, or that they crossed a line. Interfering with a goalie while he is in the crease will NOT be tolerated.
But… More often than not a fight will go through a series of steps where either participant can step out before the actual fight starts. Pushing, yelling, shoving, etc… at anytime a participant can step out… Until the gloves are dropped.