Wax was used for this, and they did also have various oils, including the petroleum based type (bitumen) which then (as now) came mostly from the Middle East, but they used mostly oils which came from plant sources, pine oils and pitch from pine trees up in the Northern part of Europe, various types of olive oil down south near the Med. They had for example a type of olive oil which was inedible and was used for lamp oil exclusively.With regard to keeping rust off armour: Would beeswax have been the best option, or would some suitable oils have been available? Alternatively, how well could it last if it got wet without such a coating, but was regularly cleaned and dried?
They also made use of whale oil, which gradually began to replace plant based oil for lamps and so on starting from the late 15th Century when the Basques started the first really systematic whale harvesting. But whale oil would probably be too stinky to put on armor.
Mail armor was cleaned by putting it in a barrel with sand and shaking it to scrub off the rust. Mail without some kind of coating of wax or oil would get rusty very fast, especially if it got wet. We are used to stainless steel today but any kind of carbon steel (which is all they had back then) gets rusty fast. Salt water is even worse.
There were other ways to preserve the armor, it could be blackened, blued or bronzed to give it a patina that could help keep off the elements, and in Japan mail like other forms of armor was lacquered. There has been some debate if lacquering was ever done in Europe but there is no evidence of it that I know of. Plate harness was quite often blackened in the forge as protection against the elements to help with maintenance, this became a signature look of mercenaries in fact. There are thousands of breast plates and half armors which are blackened.
But the bottom line is, having armor meant doing a lot of maintenance. Swords too, rust is always an issue which has to be dealt with. One fingerprint can start to be a problem in just a day or two if it's not wiped down right away.