Don't punish him, just tell him not to do it and tell him where he is to stand. So, if he is pushin on you with his head, reach over and with two fingers tap him good and hard on his jaw and use your fingers to move him off of you.
Then, if he starts moving toward you, turn toward him , raise your hand and say, "stay!" and kind of tap the air to push him back. If you do this when he barely moves and are very consistent about it, you can train him to stand in one place and not be up on you.
I know it'a kind of hard , about the head rubbing and nuzzling and such. I , too, have been told it is not wise to allow it, but I do. shame on me. I know that Mac is pretty good natured aobut it and just has an itchy face, but I insist that he wait until I have the halter off and a towel in my hand, which I then invite him to rub into. Small but crucial difference.