The Hatch Act (5 USC 7321-7326) permits employees to register and vote, contribute funds to any candidate, volunteer in "partisan" elections (i.e., elections where candidates run on political party labels), and fully participate in "non-partisan" elections (including running for office and soliciting funds). However, the Hatch Act prohibits employees from running for office or soliciting funds from the general public in "partisan" elections; engaging in political activities while on duty, in a Government office or vehicle, or while wearing a Government uniform or insignia. It also prohibits wearing political buttons while on duty.
There are different rules under the Hatch Act for career members of the Senior Executive Service. In particular, they are prohibited from taking an active role in a partisan political campaign.