Well, the only way for that to happen is to have the base un-factioned, but the pirates would be able to kill everything (turrets, docked ships) and if you do have it in a faction, no-one elses ships but your own factions can dock to it.
To set turrets to attack AI, open up the turrets bobby AI...