Bit of misinformation/misunderstanding in this thread.
If you are in a system where a ships faction is from, they are allowed to shoot you.
If you take a mission to assassinate a federation general, and you find the general in federation space, he wont get wanted. He can shoot you first, doesn't matter. If you find the general in an independent system, if he shoots you first he becomes wanted.
If a faction is hostile to you all their ships can attack you at will. You are considered one step worse than wanted. That how big a criminal you are to them. They will not get wanted for attacking you in their system. They will appear red on your scanner. If you shoot back you will get wanted, kill them you will get further wanted.