You need a green card or an insurance document that has the words Morocco clearly shown on it. Alternatively you can buy insurance as you enter, but I don't know if you'd get any thing if you claimed.
A logbook and a passport is all you should need apart from the above.
You can just turn up and buy a ticket from the port at Algeciras. I think it costs about £20 for a return. The return is open ended. I went from Algeciras to Ceuta (Spanish version of Gibralter), it was okay although it's a bit of a culture shock when you carry on to the border proper.
My top tip is don't accept anything off small children waving a badly made object at you and saying "cadeau" (gift) over and over again. Uncle Achmed is waiting round the corner to stop you after you accept and demand to know why you have bought the thing and tried to leave without paying etc. Other than that you'll love it.
ps The tarmac in town is lethal when it rains. It has an interesting mix of diesel/mud/vegetables and is much more difficult to ride than the unsurfaced roads.
3 Africa Twins/280,000 miles. If it's happened to one of mine, it's gonna happen to one of yours.....eventually.
1 Varadero/17,000 miles ridden (of 40,000 miles on the bike), it's all still new to me!
Bookmarks