Legally only in California and really then only in/around Los Angeles. You risk pandering/prostitution in other areas. But I have rarely heard of anyone being prosecuted outside LA, but it DOES happen.
Permits in LA on really based on where you are shooting. But the simple answer is yes, but most people dont get them since you would then have to inform all your neighbors that you like to film adult content.
Hope that helps,
MIchael