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 support for creating users #28

Open
brandonros opened this issue Jul 6, 2023 · 2 comments
Open

Add support for creating users #28

brandonros opened this issue Jul 6, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@brandonros
Copy link

brandonros commented Jul 6, 2023

Inspired by this Ansible playbook step:

- name: setup user
  hosts: new_droplet
  gather_facts: false
  tasks:
    - name: Ensure user "debian" exists
      ansible.builtin.user:
        name: debian
        shell: /bin/bash
        groups: sudo
        create_home: true
        home: /home/debian
        append: yes
        password: "{{ 'foobar123' | password_hash('sha512') }}"

    - name: add ssh key
      ansible.posix.authorized_key:
        user: debian
        state: present
        key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html

https://docs.ansible.com/ansible/latest/collections/ansible/posix/authorized_key_module.html

https://nixpkgs-manual-sphinx-markedown-example.netlify.app/configuration/user-mgmt.xml.html

@brandonros brandonros added the enhancement New feature or request label Jul 6, 2023
@r-vdp
Copy link
Member

r-vdp commented Jul 6, 2023

Yeah, this would need support on the Rust side to save information on created users in the state file so that we can clean them up when we deactivate or remove a user from the config (something that Ansible doesn't do).
I don't think I'll have the time in the near future to implement this, but I'd be happy to review a PR.

@aanderse
Copy link
Contributor

i have heard some really interesting ideas from @nikstur and friends about overlayfs, /etc, systemd-users, and eliminating some perl in nixos - every activation mounts a freshly built overlay on top of /etc, IIRC (please correct me if i'm wrong @nikstur!)

i suppose there are a number of things that could be made easier if overlayfs were involved... any thoughts on that approach @r-vdp?

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

No branches or pull requests

3 participants