Alright, first make your planets and disable their default templates. Then, select a planet you want to add defenders too and open the group editor. Make a new group with all of the defenders that you wish (the spawn for owner doesn't matter, you'll change it in a second). Then, open the map and notepad and find the group you made, which should look something like this.
planetItems
templateName ""
subTemplates 0
groups 1
group
condition
type "Always"
param ""
owner "NoOwner"
colonizeChance 0.000000
items 12
item "Frigates, Capitalships, static defenses (not starbases), etc."
Make sure you change the NoOwner to Pirate or RandomMilitia, whatever you think works better (it really doens't make much difference). If you want structures to spawn, you must make the planet owned by the Pirates/Milita, so change the colonize chance to 1.000000. Do this for every planet you want forified and it should work. The star works the same way, except you can't colonize stars so you can only spawn ship their.