Many things will work just fine ....but if the gun is stored in a humid environment / and the safe or rack is on an exterior wall - that is cold ....and the air around the gun cools, moisture will condense on the coldest item in the space ...( and that will always be steel, cast iron, etc ...) ....
that's why its hard to keep rust off tools ( hand tools, tablesaws, etc kept in most garages.... too much moist air around in a cold environment at nite ...and things rust...
but there are still things you can do / use oil, use a product called Bo-Shield, etc .../ put a small wattage light bulb - that stays on in the area / or a golden rod, in a safe --- or whatever ...
But it depends on what kind of environment the OP has / or how he cleans and treats the gun before he stores it ....