1 Answer
1

Cerumen [earwax] is produced in the outer third of the cartilaginous portion of
the human ear canal. It is a mixture of viscous secretions from
sebaceous glands and less-viscous ones from modified apocrine sweat
glands. The primary components of earwax are shed layers of skin,
with 60% of the earwax consisting of keratin, 12–20% saturated and
unsaturated long-chain fatty acids, alcohols, squalene and 6–9%
cholesterol.

It's purpose -- further quoted -- is that it:

protects the skin of the human ear canal, assists in cleaning and
lubrication, and also provides some protection from bacteria, fungi,
insects and water

Some interesting (and stomach churning) earwax trivia:

In medieval times earwax, and other substances such as urine, were
used to prepare pigments used by scribes to illustrate illuminated
manuscripts.

The 1832 edition of the American Frugal Housewife
said that "nothing was better than earwax to prevent the painful
effects resulting from a wound by a nail [or] skewer"; and also
recommended earwax as a remedy for cracked lips.

Before waxed thread was commonly available seamstresses would use their own earwax
to stop the cut ends of threads from fraying.