Passports should be valid for at least 6 months from the date of entry into the country. The easiest way to get a visa is at the airport or at the border positions previous payment of 50 dollars as much in Kenya as in Tanzania.
Visa and passport