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

add autosign_grains field to minion auth event #56241

Closed
wants to merge 5 commits into from

Conversation

rico256-cn
Copy link

@rico256-cn rico256-cn commented Feb 25, 2020

key code:

found_autosign_grains = True if 'autosign_grains' in load else False

eload['grains'] = load['autosign_grains'] if found_autosign_grains else None

What does this PR do?

add autosign_grains field to minion auth event data, for example:

salt/auth	{
    "_stamp": "2020-02-25T02:45:24.617314",
    "act": "accept",
    "grains": {
        "cpu_model": "Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz",
        "cpuarch": "x86_64",
        "dns": {
            "domain": "",
            "ip4_nameservers": [
                "192.168.96.2"
            ],
            "ip6_nameservers": [],
            "nameservers": [
                "192.168.96.2"
            ],
            "options": [],
            "search": [
                "localdomain"
            ],
            "sortlist": []
        },
        "domain": "localdomain",
        "fqdn": "localhost.localdomain",
        "hwaddr_interfaces": {
            "docker0": "02:42:0c:4b:e8:8e",
            "ens33": "00:0c:29:c6:5c:dc",
            "ens34": "00:0c:29:c6:5c:e6",
            "lo": "00:00:00:00:00:00"
        },
        "ip_interfaces": {
            "docker0": [
                "9.0.0.1",
                "fe80::42:cff:fe4b:e88e"
            ],
            "ens33": [
                "192.168.96.223",
                "fe80::7682:c46e:fdc7:ab11"
            ],
            "ens34": [
                "192.168.201.52",
                "fe80::d230:9771:4415:936d",
                "fe80::6a46:b255:16a2:b6b6"
            ],
            "lo": [
                "127.0.0.1",
                "::1"
            ]
        },
        "kernel": "Linux",
        "kernelrelease": "5.4.10-1.el7.elrepo.x86_64",
        "kernelversion": "#1 SMP Thu Jan 9 09:33:52 EST 2020",
        "manufacturer": "VMware, Inc.",
        "mem_total": 1963,
        "nodename": "x2",
        "num_cpus": 2,
        "os": "CentOS",
        "osarch": "x86_64",
        "osrelease": "7.6.1810",
        "productname": "VMware Virtual Platform",
        "saltversion": "3000",
        "saltversioninfo": [
            3000,
            null,
            null,
            0
        ],
        "serialnumber": "VMware-56 4d 4a b5 d1 e6 83 82-ff 13 1f 5c f0 c6 5c dc",
        "server_id": 875942337,
        "uuid": "b54a4d56-e6d1-8283-ff13-1f5cf0c65cdc"
    },
    "id": "b54a4d56-e6d1-8283-ff13-1f5cf0c65cdc",
    "pub": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx+H5M3GyNmmuP9Fe2hRp\nSsvq5RtVYgZv50WbIQMiAlGcVVCHigQCwD9SWG7J68RuIO/hbupigxVUIwGLhlyM\nPeazAA7xqpBgMYqIfJ3y1kBcJQPlUU3EU9SnGaOAvi0spe3GcLFxx+nucmLaVa1F\n69v1V2mxyOOBu8qleFuOMumHy3iKlVpAXE5f2nRixIxSsCJO/xCA3VS+A8lmTM2p\nLtwNapvLvPv2OStnW2s1aoHBF40tcqfProu3BtrimFjW4Zc9iLtuTO3gEzxjet5U\nbDCQPt2nifqPmvOfjKn6BT7tdr9ScRAZXe7HpCuhhVc8A56lrpp7Uf0viRxupxd8\ngQIDAQAB\n-----END PUBLIC KEY-----\n",
    "result": true
}

What issues does this PR fix or reference?

Previous Behavior

Remove this section if not relevant

New Behavior

Remove this section if not relevant

Tests written?

[NOTICE] Bug fixes or features added to Salt require tests.
Please review the test documentation for details on how to implement tests into Salt's test suite.

Yes/No

Commits signed with GPG?

Yes/No

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

key code:
 found_autosign_grains = True if 'autosign_grains' in load else False

eload['grains'] = load['autosign_grains'] if found_autosign_grains else None
@rico256-cn rico256-cn requested a review from a team as a code owner February 25, 2020 03:04
@ghost ghost requested a review from xeacott February 25, 2020 03:04
@rico256-cn
Copy link
Author

@xeacott

1 similar comment
@rico256-cn
Copy link
Author

@xeacott

@DmitryKuzmenko
Copy link
Contributor

@rico256-cn I'm not quite understand the reason of doing that. Could you please describe ins some details?
Also to get the changes working you have to put them directly to the salt/transport/mixins/auth.py.

@Ch3LL Ch3LL removed the request for review from a team April 15, 2020 14:19
@dwoz dwoz added has-failing-test Needs-Testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases labels May 13, 2020
@DmitryKuzmenko
Copy link
Contributor

This contains no description nor the code as a change. Looks like accidentally pushed some working code? Alos no response for more than 2 months. So I'm closing this. @rico256-cn if you still interested on this please create a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-failing-test Needs-Testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants