The easiest way unfortunately is a summertime only method, but it's by far the easiest.
Wrap the rifle in a dark black trash bag and put it on the dash or rear deck up next to the window of your car and park in the sun on a hot day with the windows up. The greenhouse effect and the black trash bag will evenly heat up the rifle and the cosmoline will come pouring out of the rifle. Then just remove and do some clean up.