Repair roof flashing
Your flashing is probably galvanized steel. They last a fairly long while, but they do rust eventually. They're usually replaced when the roofing is replaced. It's not necessarily a leak concern unless they're so severely rusted as to be collapsing. I don't recommend attempting to refinish steel flashing. The benefit just isn't there and you'd almost need to remove it to do a thorough job anyway. If it's just an appearance issue you can purchase galvanized paint (or just use gray). 

It's not difficult to replace a flashing, but you have to have a basic understanding of roofing techniques. You lift each row of shingles gently, releasing the tar strips, and pull the nails below. When you have enough shingles removed you can lift the flashing off and install a new one. Shingles are reinstalled or replaced. It's best done on a slightly warm day when the roof is in the shade.