chriselswede / hanacleaner

A house keeping script for SAP HANA
76 stars 44 forks source link

Support for running script as root #7

Closed krojzl closed 5 years ago

krojzl commented 5 years ago

Hello,

in order to increase the security for scheduled runs via cron we would like to have user key stored under the hdbuserstore of root user rather than in hdbuserstore of <sid>adm user (the logic is that fewer people are having access to root user compared to <sid>adm user and root user can anytime switch to <sid>adm user anyway).

We tested the code and when we source the environment variables via source /usr/sap/<SID>/home/.sapenv.sh then we are able to run the script - the only problem is usage of aliases from inside the script.

We developed and tested the enhancement of the code to detect whether executed from root and in such case to read the aliases from <sid>adm shell instead of "existing user" shell.

Note: we are aware of requirement to run on Python 2.7.x and we are making sure we are compliant here.

Can you please review the code enhancement and consider accepting the contribution?

Thank you.

krojzl commented 5 years ago

Note: I tried to find a way how to squash the commits seems this is disabled... Let me know if we should squash the commits on forked repository.