Custom Form 4457.
You can get it online, fill it out, then take it and the rifle to the closest CBP office where they will authorize it.
African countries recognize this form as a gun permit.

I would also recommend using a service in South Africa to get your permit there in advance. I used Rifle Permits.com.