Classification & Acquisition Range
Units with the classification "Worker" do not automatically attack enemies, and do not retaliate to attacks. However, if you give them an attack - move order, they will attack whatever comes in their acquisition range.
The downside to making a unit have the classification "Worker" is that he will appear as an idle worker when having no current action, and I believe that the unit will not auto attack when patrolling.
If you want to make them never auto attack unless attacked, you can set their acquisition range to 0, and use an attack range upgrade bug to make it so they can still attack enemies. I will explain the bug if needed.
Note that a unit's attack range cannot be greater than its acquisition range without using the attack range upgrade bug.
Classification Location - Object Editor, "Stats - Unit Classification"
Acquisition Range Location - Object Editor, "Combat - Acquisition Range"