As I remember from my Army days, it is very sticky and hard to get off. I recall placing the rifle, sans stock, under very hot running water. The cosmoline would melt and run off (about 140* so hot water heater had to be bumped up for this)--with some help from a brush. Then tearing it down, drying and lubing everything. Air compressor or heat gun would probably help right about now but might cause some rust as there would be no oil or anything on the metal.
Might be a better way now days but don't know of one myself.