Giter Site home page Giter Site logo

Comments (3)

brot avatar brot commented on July 26, 2024

I've just come across the same problem.
How should I define my pillar file to add more than one key for the same user?

I would suggest to swap "user" and "name". For example

auth.sls

{%- for name,keys in auth.items() -%}
{%- for key in keys -%}
{% if 'present' in key and key['present'] %}
{{ name }}:
ssh_auth.present:
- user: {{ key['user'] }}

pillar.example

openssh:
  auth:
    JOE_VALID_SSH_PUBLIC_KEY:
      - name: joe
        present: True
        enc: ssh-rsa
        comment: main key

It seems a bad choice to use the user as "id" in the pillar file. Better would be to make the "name" the id, as it's the output in the auth.sls anyway!? Or am I wrong?

from openssh-formula.

Sudo-Kid avatar Sudo-Kid commented on July 26, 2024

Bogdnar try changing the second "www-data" to "www-data2". You have 2 items in a list with the same name this is most likely why you are getting the error.

Brot: In the pillar example there are 2 keys for one user "JOE_VALID_SSH_PUBLIC_KEY" and "JOE_NON_VALID_SSH_PUBLIC_KEY". If you want to add a second key for "joe" you would just add a second instance of "- name: ######" and set it to "present: true".

openssh:
  auth:
    joe:
      - name: JOE_VALID_SSH_PUBLIC_KEY
        present: True
        enc: ssh-rsa
        comment: main key
      - name: JOE_SECOND_VALID_SSH_PUBLIC_KEY
        present: True
        enc: ssh-rsa
        comment: obsolete key - removed
     - name: JOE_NON_VALID_SSH_PUBLIC_KEY
        present: False
        enc: ssh-rsa
        comment: obsolete key - removed

from openssh-formula.

brot avatar brot commented on July 26, 2024

@the-kid89: Have you ever tried what you just recommended?

Bogdnar could not change "www-data" to "www-data2" because this string is used for the user. And Bogdnar don't want the third key for "www-data2". He want two keys for the user "www-data"

And that's the same reason why it's not possible to just add another entry with "present: True"

That's why I created a new branch on my fork of this repository https://github.com/brot/openssh-formula/commit/cc2b348dc3fdb7989cb7540800a70e897cfb006c (comments are welcome)
Now auth.sls is able to use the current format

joe:    # user
  - name: joe
    present: True
    source: salt://ssh_keys/joe.id_rsa.pub

or the new format where it's now possible to swap the user and name entry in the pillar

joe-desktop:
  - user: joe
    present: True
    source: salt://ssh_keys/joe.desktop.id_rsa.pub
joe-notebook:
  - user: joe
    present: True
    source: salt://ssh_keys/joe.notebook.id_rsa.pub

from openssh-formula.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.