It's not illegal to have two jobs, but usually for a FTE salaried job, you employment agreement says must tell your employer about any other jobs you have, including part time and hourly. A big reason why companies don't want you to have another tech job is that you might not really being doing either job, you outsource one or both of them. That breaks confidentiality laws when you give your subcontractor access to documents, data, source code, names of your coworkers, etc.