linux - How can you security-harden a Python program? - Stack Overflow
Python security hardening - Information Security Stack Exchange
Linux Hardening Script Recommendations
Ansible.
It looks like that script is trying to do configuration management. So why not use a configuration management tool to do so? (ansible, puppet, cfengine, etc.)
You should separate the "what configurations need to be made to secure/harden a system" and "what tool will I use to implement it".
More on reddit.comWhat does a secure Python installation look like?
Videos
You could turn your python scripts into windows executables using py2exe. That way it would be treated the same way you restrict other system binary. Be aware that it is possible to reverse-engineer by "uncompiling" it, showing the script functions and all. But as your question in only about enforcing execution authorization, i think that it will fulfill your need.
How about the use of PyPy with its sandboxing mode?
I'm afraid I'm not that familiar so I'm uncertain that it would be fully secure but certainly worth a look.
As far as I can see, your only options are:
- PyPy sandboxing
- A Python to executable compiler
- Giving users a Virtual Machine which allows Python
- Using a PC sandboxing solution to isolate Python and the file system.
I am looking for a script that will automate the hardening of a Linux server (looking at Ubuntu distro right now). I happened upon this: https://github.com/Jsitech/JShielder/blob/master/UbuntuServer_18.04LTS/jshielder.sh which looks VERY comprehensive. My only thing with this is that it may be overkill, and possibly even some redundancy exists. Was wondering what everyone uses?
Ansible.
It looks like that script is trying to do configuration management. So why not use a configuration management tool to do so? (ansible, puppet, cfengine, etc.)
You should separate the "what configurations need to be made to secure/harden a system" and "what tool will I use to implement it".
I'm working with RHEL but I use Ansible playbooks to audit and apply DISA STIG settings.