Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: add the capability to use a non local user for remote actions #66

Open
MarbolanGos opened this issue Jul 29, 2024 · 1 comment

Comments

@MarbolanGos
Copy link

MarbolanGos commented Jul 29, 2024

Hello,

Here is a case I am facing with milkcheck and i would like your view on an enhancement I made, with a very quick testing (only with remote: yes at the moment). In my case, all checks are being run as root (as usual) but due to security concerns, some tests must be achieved via a specific SIMPLE_USER which is reachable via the root ssh keys.

In a first attempt, I changed the config files to do:

cmd: "su -l %SIMPLE_USER -c 'ls'"

This is not very simple to maintain... In order to be simpler, I wanted to add an option to a service for being run as the SIMPLE_USER.

I did a modification in the code which seems to fit my needs but must be reviewed as I am not at all expert in python...

MarbolanGos added a commit to MarbolanGos/milkcheck that referenced this issue Jul 29, 2024
@MarbolanGos
Copy link
Author

Just an example:

[root@admin-node ~]# milkcheck --report=full -c /root/test_milkcheck step0 -n pm-mgt0
step0 test-mgt ran in 0.20 s
 > pm-mgt0: uid=2001(admin) gid=2001(admin) groups=2001(admin)
 > pm-mgt0 exited with 1
test-mgt - Test                                                                                            [  ERROR  ]

 SUMMARY - 1 action (1 failed)
 + test-mgt.step0 - Test
    Target: pm-mgt0
    Command: id && exit 1
# cat /root/test_milkcheck/test.yaml 
---
services:
    test-mgt:
        fanout: 324
        timeout: 30
        desc: Test
        target: "pm-mgt0"
        ssh_user: "admin"
        actions:
            step0:
                cmd: "id && exit 1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant