Before doing that, read the paperwork carefully. It may have the standard clause "All your work are belong to us". So the side project you do in your free time is also property of the agency even if it's only tangentially related to your work there.
Perhaps you may get an exception to contribute to a big open source project. You will not get money, but you will get more experience and things to put in your CV.
As a matter of fact, I am not allowed to contribute to open source projects if not officially approved (read : simply not allowed) and whatever I contribute will remain with the agency I am working for and would be classified.
Getting fired on disciplinary grounds would sum up to physical or sexual assault or smuggling components or something of that order. Not very advisable for somebody just starting his carrier, I think.
Perhaps you may get an exception to contribute to a big open source project. You will not get money, but you will get more experience and things to put in your CV.