Oh, boy, you'll hear every which way to remove the cosmoline, from a simple mineral spirits wipe-down to baking in home-made ovens to power-washing it at the local car wash. It really depends on a couple of factors - how much cosmoline is sill on the rifle in question (the importers/resellers often remove most of it), how deeply it has soaked into the wood, and how much do you want to remove in case you want to re-work the finish. I'm a big believer in using only enough solvent/horsepower to get the job done, so I tend towards mineral spirits. Disassemble the rifle and bolt, and soak them in the spirits. Chances are the cosmoline will have soaked into the wood somewhat, and what you don't get out will re-appear on hot days. Some people will put them in black trash bags and sit them in the sun, wiping them down periodically.
My 24/47 had little cosmoline on it overall and very little soaked in. I cleaned everything extensively with spirits, and did a boiled linseed oil scrub on the stock, and it's clean enough for me.