Its bedding compound, there are many kinds on the market and which kind works best depends from the kind of hardware.
Some are strong adhesives, consider them pretty much permanent, will work well on things that are put in place once and rarely or never removed, 3M 5200 is a polyurethane adhesive of this kind. Many hate it but it has its uses. It cures hard, tire rubber like.
Some others will adhere and seal any space between the hardware and the structure its attached to but the adhesion is not strong, these are designed so that the hardware can be removed for maintenance or repairs while still performing all the duties of a bedding compound.
A common one is Dolfinite, which is a class of its own, old tech.
Polysulfide bedding compounds are often used but they attack some plastics.
These are just some, there are many others, the brands are many too, everyone seems to have their own line that goes from adhesives to sealants and everything in between. (And of course there are the homemade formulas)
To re-fit you could even check out butyl tape (not the plain hardware store stuff as its quality is not the best), it needs to squeeze out when you fix the hardware, this stays pliable forever, it will seal even if there's some movement.