there is a kit for that, rustoleum product I believe.
There are several brands of tub refinishing kits, all are epoxy paint.
I have done two sinks and a cultured marble tub with these. But for our rusted out tub, I had Miracle Method professionals re do it. They can rebuild rust damage areas before spraying the Epoxy.
Like any paint job the key to a good finish is the prep work of cleaning and sanding if you DIY.
Rustoleum or Homax tub and tile paint kits.
I would do it professional. I used Rustoleum and after a white the water caused it to peel, and it was a mess, parts were still on and large peel marks came off. I had to fill the tub with hot water and let it sit, then start the peeling process. Took months..... to get it all off. I would NEVER do that again, you have been warned.
I followed all directions too. Only way this would work is if you didn't actually use the tub and just admired it!
I had mixed results working on a sink. Reglazing it is supposed to last