From 64d2556102f6346cc097a3cb96a8330f2d468d31 Mon Sep 17 00:00:00 2001 From: Marek Isalski Date: Sat, 22 Feb 2020 17:38:47 +0000 Subject: [PATCH] template up the users --- vyos.conf.j2 | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/vyos.conf.j2 b/vyos.conf.j2 index c4857d0..fb6d0cb 100644 --- a/vyos.conf.j2 +++ b/vyos.conf.j2 @@ -1014,13 +1014,27 @@ system { } login { - user vyos { + {% for user, user_data in pillar['users'].items() %} + user {{ user }} { + {% if 'authentication' in user_data %} authentication { - encrypted-password $6$fXZ3cwEft1XFJTH$twZmVheX0PEi21KqQfv/zvKhuXVc1UwVVXI3Y7KCXYk0osil3QmJqmAYgNQyNqGUROydxp7R6yiPe4N06QnBH1 + {% if 'encrypted-password' in user_data['authentication'] %} + encrypted-password {{ user_data['authentication']['encrypted-password'] }} plaintext-password "" + {% else %} + plaintext-password '{{ user_data['authentication']['plaintext-password'] }}' + {% endif %} + {% for key, key_data in user_data['authentication'].get('public-keys',{}).items() %} + public-keys {{ key }} { + key {{ key_data['key'] }} + type {{ key_data.get('type','ssh-rsa') }} + } + {% endfor %} } - level admin + {% endif %} + level {{ user_data.get('level','operator') }} } + {% endfor %} } {% for nameserver in pillar['nameservers'] %}