EmbedPython allows to use normal python scripts as micro-services.
embedPython has a serious security flaw. It allows a remote code execution. More details can be found in our report.
This module is written in Python hence in order to use it you have to install Python support for iRODS. There is an external project offering such an integration called PyRods. The code can be downloaded from (select a version proper for your iRODS installation) project download section.
The installation depends on the configuration you selected for you iRODS (for instance what kind of database back-end you have selected). In short you have to expand the archive into iRODS installation directory, adjust the pyRods/setup.cfg so that irods_dir flag points on the directory where you have installed iRODS, for instance:
irods_dir=/home/rods/iRODS
If you are not using bundled-in PostgreSQL you have to adjust paths
PyRODS/setup.py:
pgsql_objects = ['/lib/libodbc.so'] self.postgres_home = ''
Start the installation:
python setup.py build sudo python setup.py install
and restart irods irodsctl restart.
In order to be able to use Python micro-services in iRODS rules you have install embedPython module. It can be downloaded from the same source as PyRods. The archive has to be expanded into iRODS/modules/. In the next step you shall adjust the Makefile of embedPython to your Python version used, afterwards you can start the installation by issuing following commands in iRODS home directory:
./scripts/configure --enable-_embedPython_ make
To check if the iRODS python integration is working properly prepare two files. First of all a example python script
example.py
def test_python(rei): f = open('/tmp/python_workfile', 'w') f.write('This is a test\n') f.close()
You will also have to prepare an iRODS rule using python micro-services, for instance:
pythonrule.r
testPythoni () { msiPyInitialize(); msiLocalPython(*pyScript, *methName, "noRecursionTest") msiPyFinalize(); } INPUT *pyScript="path_to/example.py", *methName="test_python" OUTPUT ruleExecOut
The second file is an example of iRODS rule which calls a normal python script. If your installation is working properly it should be possible to run irule -F pythonrule.r and it should create a file /tmp/python_workfile.
This manual encompass only the basic steps needed to install PyRods and embedPython, a more detailed steps and some troubleshooting tips can be found in the project wiki: