add initial support for testing nfs with krb5
v2 cover add initial support for testing nfs with krb5
These patches add support for running fstests on NFS with krb5. There are numerous other fixes and cleanups, but the bulk of the work is in patch 10.
There are a handful of new Kconfig options (KDEVOPS_SETUP_KRB5, KRB5_REALM, KRB5_ADMIN_PW, and FSTESTS_NFS_AUTH_FLAVOR) as well as some new Makefile targets ("kdc" and "krb5", both of which get executed automatically). During "make bringup", a KDC is spun up automatically, and all the necessary package dependencies are installed, keys are generated, and the keytabs are updated on the NFS client and server VMs.
Right now you can only use krb5 with the fstests workflow, but it should be straightforward to add it to the other NFS-related workflows.
-Scott
Changes since v1:
- Added a pipefs-directory config in nfs.conf to fix a debian issue.
- Moved update_etc_hosts target to run as an early bringup dependency.
- Cleaned up the top level Makefile and bringup.Makefile by moving some directives into lower level makefiles for nfsd, ktls, siw, and krb5.
- Added a kdevops_nfsd_enable variable and use that instead of checking if nfsd_threads is defined in several places.
- Cleaned up the hosts file by making sure "nfsd" and "nfsd:vars" stanzas do not get created if nfsd isn't enabled.
- Cleaned up the hosts file by making sure "krb5", "krb5:vars", "kdc", and "kdc:vars" stanzas do not get created if krb5 isn't enabled.
- Cleaned up Kconfig.bringup.goals by moving some directives into lower level kconfigs for nfsd and krb5.
- Added a kdevops_krb5_enable variable and use that instead of checking if krb5_realm is defined in several places.
- Folded the kdc.Makefile into the krb5.Makefile (there's no reason for them to have two separate makefiles).
- Added some default vars settings for the KDC.
- Got rid of some unnecessary tasks in the krb5 role that check to see if a principal existed before creating it, and also before adding it to the keytab (in reality these checks were just triggering errors that needed to be ignored).
- Forced the restart rpc.gssd task in the krb5 role to only run on the nfsd server (because rpc.gssd isn't installed on the clients yet at the point when the krb5 role is executed).
- Made the krb5 target to run automatically as a late bringup dependency.
Scott Mayhew (10):
nfsd: make sure the appropriate fsprogs package is installed
update_etc_hosts: fix up hostnames on debian guestfs hosts
nfsd: use EXTRA_VAR_INPUTS for export options
devconfig: set /etc/hostname earlier
nfsd: add a pipefs-directory config to nfs.conf
bringup: move the update_etc_hosts task to run early
bringup: clean up the nfs-related make targets gen_hosts/gen_nodes: clean up nfsd-related stuff
kconfigs: clean up Kconfig.bringup.goals fstests/nfs: add krb5 support
Makefile | 10 +- kconfigs/Kconfig.bringup.goals | 13 +- kconfigs/Kconfig.krb5 | 25 ++++ kconfigs/Kconfig.nfsd | 16 +++ playbooks/kdc.yml | 4 + playbooks/krb5.yml | 4 + playbooks/roles/devconfig/tasks/main.yml | 21 ++-- .../fstests/tasks/install-deps/suse/main.yml | 10 ++ playbooks/roles/fstests/tasks/main.yml | 41 ++++++ .../roles/fstests/templates/nfs/nfsmount.conf | 2 + playbooks/roles/gen_hosts/defaults/main.yml | 3 + .../roles/gen_hosts/templates/fstests.j2 | 19 ++- playbooks/roles/gen_hosts/templates/gitr.j2 | 4 +- playbooks/roles/gen_hosts/templates/hosts.j2 | 6 +- playbooks/roles/gen_nodes/defaults/main.yml | 2 + playbooks/roles/gen_nodes/tasks/main.yml | 25 +++- .../kdc/tasks/install-deps/debian/main.yml | 11 ++ .../roles/kdc/tasks/install-deps/main.yml | 12 ++ .../kdc/tasks/install-deps/redhat/main.yml | 16 +++ .../kdc/tasks/install-deps/suse/main.yml | 10 ++ playbooks/roles/kdc/tasks/main.yml | 119 ++++++++++++++++++ playbooks/roles/kdc/templates/kadm5.acl.j2 | 1 + playbooks/roles/kdc/templates/kdc.conf.j2 | 15 +++ playbooks/roles/kdc/templates/krb5.conf.j2 | 29 +++++ playbooks/roles/kdc/vars/Debian.yml | 7 ++ playbooks/roles/kdc/vars/RedHat.yml | 7 ++ playbooks/roles/kdc/vars/Suse.yml | 7 ++ playbooks/roles/kdc/vars/default.yml | 7 ++ playbooks/roles/kdc/vars/main.yml | 1 + .../krb5/tasks/install-deps/debian/main.yml | 9 ++ .../roles/krb5/tasks/install-deps/main.yml | 12 ++ .../krb5/tasks/install-deps/redhat/main.yml | 15 +++ .../krb5/tasks/install-deps/suse/main.yml | 16 +++ playbooks/roles/krb5/tasks/main.yml | 52 ++++++++ playbooks/roles/krb5/templates/krb5.conf.j2 | 31 +++++ .../nfsd/tasks/install-deps/debian/main.yml | 33 ++++- .../nfsd/tasks/install-deps/redhat/main.yml | 31 +++-- .../nfsd/tasks/install-deps/suse/main.yml | 32 ++++- playbooks/roles/nfsd/templates/nfs.conf.j2 | 3 + playbooks/roles/nfsd/vars/Debian.yml | 13 ++ playbooks/roles/nfsd/vars/RedHat.yml | 14 +++ playbooks/roles/nfsd/vars/Suse.yml | 12 ++ .../roles/update_etc_hosts/tasks/main.yml | 26 +++- playbooks/update_etc_hosts.yml | 1 + scripts/bringup.Makefile | 19 +-- scripts/krb5.Makefile | 22 ++++ scripts/ktls.Makefile | 7 ++ scripts/nfsd.Makefile | 17 ++- scripts/siw.Makefile | 6 + scripts/update_etc_hosts.Makefile | 7 ++ workflows/fstests/nfs/Kconfig | 29 +++++ workflows/fstests/nfs/Makefile | 4 + 52 files changed, 778 insertions(+), 80 deletions(-) create mode 100644 kconfigs/Kconfig.krb5 create mode 100644 playbooks/kdc.yml create mode 100644 playbooks/krb5.yml create mode 100644 playbooks/roles/fstests/templates/nfs/nfsmount.conf create mode 100644 playbooks/roles/kdc/tasks/install-deps/debian/main.yml create mode 100644 playbooks/roles/kdc/tasks/install-deps/main.yml create mode 100644 playbooks/roles/kdc/tasks/install-deps/redhat/main.yml create mode 100644 playbooks/roles/kdc/tasks/install-deps/suse/main.yml create mode 100644 playbooks/roles/kdc/tasks/main.yml create mode 100644 playbooks/roles/kdc/templates/kadm5.acl.j2 create mode 100644 playbooks/roles/kdc/templates/kdc.conf.j2 create mode 100644 playbooks/roles/kdc/templates/krb5.conf.j2 create mode 100644 playbooks/roles/kdc/vars/Debian.yml create mode 100644 playbooks/roles/kdc/vars/RedHat.yml create mode 100644 playbooks/roles/kdc/vars/Suse.yml create mode 100644 playbooks/roles/kdc/vars/default.yml create mode 100644 playbooks/roles/kdc/vars/main.yml create mode 100644 playbooks/roles/krb5/tasks/install-deps/debian/main.yml create mode 100644 playbooks/roles/krb5/tasks/install-deps/main.yml create mode 100644 playbooks/roles/krb5/tasks/install-deps/redhat/main.yml create mode 100644 playbooks/roles/krb5/tasks/install-deps/suse/main.yml create mode 100644 playbooks/roles/krb5/tasks/main.yml create mode 100644 playbooks/roles/krb5/templates/krb5.conf.j2 create mode 100644 playbooks/roles/nfsd/vars/Debian.yml create mode 100644 playbooks/roles/nfsd/vars/RedHat.yml create mode 100644 playbooks/roles/nfsd/vars/Suse.yml create mode 100644 scripts/krb5.Makefile create mode 100644 scripts/update_etc_hosts.Makefile
Signature · 1 line
2.43.0
PATCH v2 1/10 nfsd: make sure the appropriate fsprogs package is installed
The virt-builder images don't have all of the fsprogs packages installed by default, so make sure to install whatever package is needed for the filesystem being exported.
--- .../nfsd/tasks/install-deps/debian/main.yml | 28 ++++++++++++++--- .../nfsd/tasks/install-deps/redhat/main.yml | 31 ++++++++++++++----- .../nfsd/tasks/install-deps/suse/main.yml | 27 +++++++++++++--- playbooks/roles/nfsd/vars/Debian.yml | 11 +++++++ playbooks/roles/nfsd/vars/RedHat.yml | 12 +++++++ playbooks/roles/nfsd/vars/Suse.yml | 10 ++++++ 6 files changed, 102 insertions(+), 17 deletions(-) create mode 100644 playbooks/roles/nfsd/vars/Debian.yml create mode 100644 playbooks/roles/nfsd/vars/RedHat.yml create mode 100644 playbooks/roles/nfsd/vars/Suse.yml
playbooks/roles/nfsd/tasks/install-deps/debian/main.yml +23 -5
@@ -1,13 +1,31 @@ --- +- name: Get OS-specific variables + ansible.builtin.include_vars: "{{ lookup('ansible.builtin.first_found', params) }}" + vars: + params: + files: + - '{{ansible_distribution}}.yml' + - '{{ansible_os_family}}.yml' + - default.yml + paths: + - 'vars' + +- name: Determine which fsprogs package is needed for "{{ nfsd_export_fstype }}" + set_fact: + fsprogs: "{{ fstype_userspace_progs[nfsd_export_fstype] | default() }}" + +- name: Add {{ fsprogs }} to the nfsd packages list + set_fact: + nfsd_packages: "{{ nfsd_packages + [fsprogs] }}" + when: + - fsprogs is defined + - fsprogs + - name: Install nfsd dependencies become: yes become_method: sudo apt: - name: - - lvm2 - - nfs-common - - nfs-kernel-server - - policycoreutils + name: "{{ nfsd_packages }}" state: present update_cache: yes tags: [ 'pynfs', 'deps' ]
playbooks/roles/nfsd/tasks/install-deps/redhat/main.yml +23 -8
@@ -1,18 +1,33 @@ --- +- name: Get OS-specific variables + ansible.builtin.include_vars: "{{ lookup('ansible.builtin.first_found', params) }}" + vars: + params: + files: + - '{{ansible_distribution}}.yml' + - '{{ansible_os_family}}.yml' + - default.yml + paths: + - 'vars' + +- name: Determine which fsprogs package is needed for "{{ nfsd_export_fstype }}" + set_fact: + fsprogs: "{{ fstype_userspace_progs[nfsd_export_fstype] | default() }}" + +- name: Add {{ fsprogs }} to the nfsd packages list + set_fact: + nfsd_packages: "{{ nfsd_packages + [fsprogs] }}" + when: + - fsprogs is defined + - fsprogs + - name: Install nfsd dependencies become: yes become_method: sudo yum: update_cache: yes - name: "{{ packages }}" + name: "{{ nfsd_packages }}" retries: 3 delay: 5 register: result until: result.rc == 0 - vars: - packages: - - checkpolicy - - lvm2 - - nfs-utils - - policycoreutils - - python3-policycoreutils
playbooks/roles/nfsd/tasks/install-deps/suse/main.yml +23 -4
@@ -1,10 +1,29 @@ --- +- name: Get OS-specific variables + ansible.builtin.include_vars: "{{ lookup('ansible.builtin.first_found', params) }}" + vars: + params: + files: + - '{{ansible_distribution}}.yml' + - '{{ansible_os_family}}.yml' + - default.yml + paths: + - 'vars' + +- name: Determine which fsprogs package is needed for "{{ nfsd_export_fstype }}" + set_fact: + fsprogs: "{{ fstype_userspace_progs[nfsd_export_fstype] | default() }}" + +- name: Add {{ fsprogs }} to the nfsd packages list + set_fact: + nfsd_packages: "{{ nfsd_packages + [fsprogs] }}" + when: + - fsprogs is defined + - fsprogs + - name: Install nfsd dependencies become: yes become_method: sudo zypper: - name: - - lvm2 - - nfs-utils - - policycoreutils + name: "{{ nfsd_packages }}" state: present
playbooks/roles/nfsd/vars/Debian.yml new file +11 -0
@@ -0,0 +1,11 @@ +--- +nfsd_packages: + - lvm2 + - nfs-common + - nfs-kernel-server + - policycoreutils + +fstype_userspace_progs: + btrfs: btrfs-progs + ext4: e2fsprogs + xfs: xfsprogs
playbooks/roles/nfsd/vars/RedHat.yml new file +12 -0
@@ -0,0 +1,12 @@ +--- +nfsd_packages: + - checkpolicy + - lvm2 + - nfs-utils + - policycoreutils + - python3-policycoreutils + +fstype_userspace_progs: + btrfs: btrfs-progs + ext4: e2fsprogs + xfs: xfsprogs
playbooks/roles/nfsd/vars/Suse.yml new file +10 -0
@@ -0,0 +1,10 @@ +--- +nfsd_packages: + - lvm2 + - nfs-utils + - policycoreutils + +fstype_userspace_progs: + btrfs: btrfsprogs + ext4: e2fsprogs + xfs: xfsprogs
Signature · 1 line
2.43.0
PATCH v2 2/10 update_etc_hosts: fix up hostnames on debian guestfs hosts
In reply to Scott MayhewSince we're not currently using DNS domains in our hostnames, debian guestfs hosts wind up with an entry like this in /etc/hosts:
127.0.1.1 unassigned-hostname.unassigned-domain foo
which causes the ansible_fqdn variable to report "unassigned-hostname.unassigned-domain". Get rid of the "unassigned-hostname.unassigned-domain" part, so that ansible_fqdn reports the short hostname "foo" instead.
--- playbooks/roles/update_etc_hosts/tasks/main.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+)
playbooks/roles/update_etc_hosts/tasks/main.yml +12 -0
@@ -65,3 +65,15 @@ with_items: "{{ ueh_hosts }}" when: - not terraform_private_net_enabled + +- name: Fix up hostname on Debian guestfs hosts + become: yes + become_method: sudo + lineinfile: + path: /etc/hosts + regexp: '^(127\.0\.1\.1)(\s+)unassigned-hostname\.unassigned-domain\s+({{ ansible_hostname }})$' + backrefs: yes + line: '\1\2\3' + when: + - ansible_os_family == 'Debian' + - kdevops_enable_guestfs
Signature · 1 line
2.43.0
PATCH v2 3/10 nfsd: use EXTRA_VAR_INPUTS for export options
In reply to Scott MayhewThe most_extra_vars target in Makefile.extra_vars replaces '=' with ':', which breaks any export options that use '='. So use EXTRA_VAR_INPUTS and quote the export options string instead.
--- scripts/nfsd.Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
scripts/nfsd.Makefile +7 -1
@@ -2,10 +2,16 @@ NFSD_EXTRA_ARGS += nfsd_export_device_prefix='$(subst ",,$(CONFIG_NFSD_EXPORT_DE NFSD_EXTRA_ARGS += nfsd_export_device_count='$(subst ",,$(CONFIG_NFSD_EXPORT_DEVICE_COUNT))' NFSD_EXTRA_ARGS += nfsd_export_fstype='$(subst ",,$(CONFIG_NFSD_EXPORT_FSTYPE))' NFSD_EXTRA_ARGS += nfsd_export_path='$(subst ",,$(CONFIG_NFSD_EXPORT_PATH))' -NFSD_EXTRA_ARGS += nfsd_export_options='$(subst ",,$(CONFIG_NFSD_EXPORT_OPTIONS))' NFSD_EXTRA_ARGS += nfsd_threads=$(CONFIG_NFSD_THREADS) NFSD_EXTRA_ARGS += nfsd_lease_time=$(CONFIG_NFSD_LEASE_TIME) +EXTRA_VAR_INPUTS += extend-extra-args-nfsd + +extend-extra-args-nfsd: + $(Q)echo "nfsd_export_options: '$(CONFIG_NFSD_EXPORT_OPTIONS)'" >> $(KDEVOPS_EXTRA_VARS) ;\ + +PHONY += extend-extra-args-nfsd + ANSIBLE_EXTRA_ARGS += $(NFSD_EXTRA_ARGS) nfsd:
Signature · 1 line
2.43.0
PATCH v2 4/10 devconfig: set /etc/hostname earlier
In reply to Scott MayhewI noticed that opensuse-tumbleweed guestfs VMs were still showing up as 'localhost.localdomain', even though /etc/hostname had the correct hostnames.
Update /etc/hostname before the distro-specific install tasks, so that the reboot that occurs causes the hostname change to actually take effect.
--- playbooks/roles/devconfig/tasks/main.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
playbooks/roles/devconfig/tasks/main.yml +12 -9
@@ -17,6 +17,18 @@ setup: tags: always +# Update /etc/hostname first so the change gets picked up by the reboot +# that occurs during the distro-specific tasks + +- name: Ensure /etc/hostname is set + become: yes + become_flags: 'su - -c' + become_method: sudo + template: + src: hostname + dest: /etc/hostname + tags: hostname + # Distro specific - name: Install dependencies import_tasks: install-deps/main.yml
@@ -28,15 +40,6 @@ # Distro agnostic stuff goes below -- name: Ensure /etc/hostname is set - become: yes - become_flags: 'su - -c' - become_method: sudo - template: - src: hostname - dest: /etc/hostname - tags: hostname - - name: Check if the developer has a git config delegate_to: localhost stat:
Signature · 1 line
2.43.0
PATCH v2 5/10 nfsd: add a pipefs-directory config to nfs.conf
In reply to Scott MayhewDebian uses /run/rpc_pipefs for the pipefs mountpoint by default, but the nfs.conf that we deploy doesn't have a pipefs-directory configuration.
That will cause any userspace daemons that use the pipefs to fail to start/restart because they'll now be looking for the pipefs to be mounted on /var/lib/nfs/rpc_pipefs... unless we reboot the nfsd server after we overwrite Debian's default nfs.conf with our own.
So let's just add the pipefs-directory configuration to nfs.conf instead.
--- playbooks/roles/nfsd/templates/nfs.conf.j2 | 3 +++ playbooks/roles/nfsd/vars/Debian.yml | 2 ++ playbooks/roles/nfsd/vars/RedHat.yml | 2 ++ playbooks/roles/nfsd/vars/Suse.yml | 2 ++ 4 files changed, 9 insertions(+)
playbooks/roles/nfsd/templates/nfs.conf.j2 +3 -0
@@ -1,3 +1,6 @@ +[general] +pipefs-directory={{ pipefs_directory }} + [nfsd] udp=y threads={{ nfsd_threads }}
playbooks/roles/nfsd/vars/Debian.yml +2 -0
@@ -9,3 +9,5 @@ fstype_userspace_progs: btrfs: btrfs-progs ext4: e2fsprogs xfs: xfsprogs + +pipefs_directory: /run/rpc_pipefs
playbooks/roles/nfsd/vars/RedHat.yml +2 -0
@@ -10,3 +10,5 @@ fstype_userspace_progs: btrfs: btrfs-progs ext4: e2fsprogs xfs: xfsprogs + +pipefs_directory: /var/lib/nfs/rpc_pipefs
playbooks/roles/nfsd/vars/Suse.yml +2 -0
@@ -8,3 +8,5 @@ fstype_userspace_progs: btrfs: btrfsprogs ext4: e2fsprogs xfs: xfsprogs + +pipefs_directory: /var/lib/nfs/rpc_pipefs
Signature · 1 line
2.43.0
PATCH v2 6/10 bringup: move the update_etc_hosts task to run early
In reply to Scott MayhewPreviously, update_etc_hosts was run after all of the other bringup dependencies. Fix this by making it an early (i.e. KDEVOPS_BRING_UP_DEPS_EARLY) task. This serves two purposes. First, it allows the top-level makefiles to be cleaned up a bit. Second, it allows other bringup tasks (i.e. KDEVOPS_BRING_UP_DEPS and KDEVOPS_BRING_UP_LATE_DEPS tasks) to rely on the fact that /etc/hosts has already been updated on the target hosts.
--- Makefile | 1 + playbooks/roles/update_etc_hosts/tasks/main.yml | 14 +++++++++----- playbooks/update_etc_hosts.yml | 1 + scripts/bringup.Makefile | 6 +----- scripts/update_etc_hosts.Makefile | 7 +++++++ 5 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 scripts/update_etc_hosts.Makefile
Makefile +1 -0
@@ -95,6 +95,7 @@ ANSIBLE_EXTRA_ARGS += $(LOCAL_DEVELOPMENT_ARGS) include scripts/provision.Makefile include scripts/systemd-timesync.Makefile include scripts/journal-server.Makefile +include scripts/update_etc_hosts.Makefile KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_BRING_UP_DEPS_EARLY) KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_PROVISIONED_DEVCONFIG)
playbooks/roles/update_etc_hosts/tasks/main.yml +9 -5
@@ -1,8 +1,4 @@ -- name: Gather network facts - ansible.builtin.setup: - gather_subset: - - 'network' - +--- - name: Import optional extra_args file include_vars: "{{ item }}" ignore_errors: yes
@@ -14,6 +10,14 @@ skip: true tags: vars +- name: Wait for hosts to become available + wait_for_connection: + +- name: Gather network facts + ansible.builtin.setup: + gather_subset: + - 'network' + - name: Build network address set_fact: private_network: "{{ terraform_private_net_prefix }}/{{ terraform_private_net_mask }}"
playbooks/update_etc_hosts.yml +1 -0
@@ -1,4 +1,5 @@ --- - hosts: all + gather_facts: no roles: - role: update_etc_hosts
scripts/bringup.Makefile +1 -5
@@ -33,11 +33,7 @@ ifeq (y,$(CONFIG_KDEVOPS_SETUP_SIW)) KDEVOPS_BRING_UP_DEPS += siw endif # KDEVOPS_SETUP_SIW -update_etc_hosts: - $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - -f 30 -i hosts playbooks/update_etc_hosts.yml - -bringup: $(KDEVOPS_BRING_UP_DEPS) update_etc_hosts +bringup: $(KDEVOPS_BRING_UP_DEPS) destroy: $(KDEVOPS_DESTROY_DEPS)
scripts/update_etc_hosts.Makefile new file +7 -0
@@ -0,0 +1,7 @@ +update_etc_hosts: + $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ + -f 30 -i hosts playbooks/update_etc_hosts.yml + +KDEVOPS_BRING_UP_DEPS_EARLY += update_etc_hosts + +PHONY += update_etc_hosts
Signature · 1 line
2.43.0
PATCH v2 7/10 bringup: clean up the nfs-related make targets
In reply to Scott MayhewClean up the top level Makefile and scripts/brinup.Makefile by moving the following into the lower level Makefiles for the nfs-related make targets (ktls, nfsd, and siw):
1. The "ifeq (y,$(CONFIG_KDEVOPS_SETUP_foo))" directives.
2. The updates of the KDEVOPS_BRING_UP_DEPS/KDEVOPS_BRING_UP_DESTROY variables.
There should be no change in behavior.
--- Makefile | 8 -------- scripts/bringup.Makefile | 13 ------------- scripts/ktls.Makefile | 7 +++++++ scripts/nfsd.Makefile | 8 ++++++++ scripts/siw.Makefile | 6 ++++++ 5 files changed, 21 insertions(+), 21 deletions(-)
Makefile +0 -8
@@ -104,17 +104,9 @@ ifeq (y,$(CONFIG_WORKFLOWS)) include workflows/Makefile endif # CONFIG_WORKFLOWS -ifeq (y,$(CONFIG_KDEVOPS_SETUP_SIW)) include scripts/siw.Makefile -endif # CONFIG_KDEVOPS_SETUP_SIW - -ifeq (y,$(CONFIG_KDEVOPS_SETUP_KTLS)) include scripts/ktls.Makefile -endif # CONFIG_KDEVOPS_SETUP_KTLS - -ifeq (y,$(CONFIG_KDEVOPS_SETUP_NFSD)) include scripts/nfsd.Makefile -endif # CONFIG_KDEVOPS_SETUP_NFSD include scripts/devconfig.Makefile include scripts/ssh.Makefile
scripts/bringup.Makefile +0 -13
@@ -20,19 +20,6 @@ endif endif -ifeq (y,$(CONFIG_KDEVOPS_SETUP_NFSD)) -KDEVOPS_BRING_UP_DEPS += nfsd -endif # KDEVOPS_SETUP_NFSD - -ifeq (y,$(CONFIG_KDEVOPS_SETUP_KTLS)) -KDEVOPS_BRING_UP_DEPS += ktls -KDEVOPS_DESTROY_DEPS += ktls-destroy -endif # KDEVOPS_SETUP_KTLS - -ifeq (y,$(CONFIG_KDEVOPS_SETUP_SIW)) -KDEVOPS_BRING_UP_DEPS += siw -endif # KDEVOPS_SETUP_SIW - bringup: $(KDEVOPS_BRING_UP_DEPS) destroy: $(KDEVOPS_DESTROY_DEPS)
scripts/ktls.Makefile +7 -0
@@ -1,3 +1,5 @@ +ifeq (y,$(CONFIG_KDEVOPS_SETUP_KTLS)) + ktls: $(Q)ansible-playbook $(ANSIBLE_VERBOSE) --extra-vars=@./extra_vars.yaml \ -f 30 -i hosts playbooks/ktls.yml
@@ -5,4 +7,9 @@ ktls: ktls-destroy: $(Q)rm -rf $(TOPDIR)/ca +KDEVOPS_BRING_UP_DEPS += ktls +KDEVOPS_DESTROY_DEPS += ktls-destroy + PHONY += ktls ktls-destroy + +endif
scripts/nfsd.Makefile +8 -0
@@ -1,3 +1,5 @@ +ifeq (y,$(CONFIG_KDEVOPS_SETUP_NFSD)) + NFSD_EXTRA_ARGS += nfsd_export_device_prefix='$(subst ",,$(CONFIG_NFSD_EXPORT_DEVICE_PREFIX))' NFSD_EXTRA_ARGS += nfsd_export_device_count='$(subst ",,$(CONFIG_NFSD_EXPORT_DEVICE_COUNT))' NFSD_EXTRA_ARGS += nfsd_export_fstype='$(subst ",,$(CONFIG_NFSD_EXPORT_FSTYPE))'
@@ -17,3 +19,9 @@ ANSIBLE_EXTRA_ARGS += $(NFSD_EXTRA_ARGS) nfsd: $(Q)ansible-playbook $(ANSIBLE_VERBOSE) --extra-vars=@./extra_vars.yaml \ -f 30 -i hosts -l nfsd playbooks/nfsd.yml + +KDEVOPS_BRING_UP_DEPS += nfsd + +PHONY += nfsd + +endif
scripts/siw.Makefile +6 -0
@@ -1,5 +1,11 @@ +ifeq (y,$(CONFIG_KDEVOPS_SETUP_SIW)) + siw: $(Q)ansible-playbook $(ANSIBLE_VERBOSE) --extra-vars=@./extra_vars.yaml \ -f 30 -i hosts playbooks/siw.yml +KDEVOPS_BRING_UP_DEPS += siw + PHONY += siw + +endif
Signature · 1 line
2.43.0
PATCH v2 8/10 gen_hosts/gen_nodes: clean up nfsd-related stuff
In reply to Scott MayhewFirst, instead of checking if nfsd_threads is defined, create new variable kdevops_nfsd_enable and use that.
Second, if nfsd is not enabled, then there shouldn't be "nfsd" and "nfsd:vars" stanzas in the hosts file, so adjust the placement of the conditionals in the templates accordingly.
No change in behavior.
--- playbooks/roles/gen_hosts/defaults/main.yml | 2 ++ playbooks/roles/gen_hosts/templates/fstests.j2 | 4 ++-- playbooks/roles/gen_hosts/templates/gitr.j2 | 4 ++-- playbooks/roles/gen_hosts/templates/hosts.j2 | 6 +++--- playbooks/roles/gen_nodes/defaults/main.yml | 1 + playbooks/roles/gen_nodes/tasks/main.yml | 6 +++--- scripts/nfsd.Makefile | 1 + 7 files changed, 14 insertions(+), 10 deletions(-)
playbooks/roles/gen_hosts/defaults/main.yml +2 -0
@@ -30,3 +30,5 @@ is_fstests: False fstests_fstyp: "bogus" fs_config_role_path: "/dev/null" fs_config_data: "[section_1]" + +kdevops_nfsd_enable: False
playbooks/roles/gen_hosts/templates/fstests.j2 +2 -2
@@ -21,9 +21,9 @@ ansible_python_interpreter = "{{ kdevops_python_interpreter }}" {% endif %} [dev:vars] ansible_python_interpreter = "{{ kdevops_python_interpreter }}" +{% if kdevops_nfsd_enable %} [nfsd] -{% if nfsd_threads is defined %} {{ kdevops_hosts_prefix }}-nfsd -{% endif %} [nfsd:vars] ansible_python_interpreter = "{{ kdevops_python_interpreter }}" +{% endif %}
playbooks/roles/gen_hosts/templates/gitr.j2 +2 -2
@@ -15,9 +15,9 @@ ansible_python_interpreter = "{{ kdevops_python_interpreter }}" {% endif %} [dev:vars] ansible_python_interpreter = "{{ kdevops_python_interpreter }}" +{% if kdevops_nfsd_enable %} [nfsd] -{% if nfsd_threads is defined %} {{ kdevops_hosts_prefix }}-nfsd -{% endif %} [nfsd:vars] ansible_python_interpreter = "{{ kdevops_python_interpreter }}" +{% endif %}
playbooks/roles/gen_hosts/templates/hosts.j2 +3 -3
@@ -14,7 +14,7 @@ write-your-own-template-for-your-workflow-and-task {% if kdevops_baseline_and_dev == True %} {{ kdevops_hosts_prefix }}-dev {% endif %} -{% if nfsd_threads is defined %} +{% if kdevops_nfsd_enable %} {{ kdevops_hosts_prefix }}-nfsd {% endif %} [all:vars]
@@ -29,10 +29,10 @@ ansible_python_interpreter = "{{ kdevops_python_interpreter }}" {% endif %} [dev:vars] ansible_python_interpreter = "{{ kdevops_python_interpreter }}" +{% if kdevops_nfsd_enable %} [nfsd] -{% if nfsd_threads is defined %} {{ kdevops_hosts_prefix }}-nfsd -{% endif %} [nfsd:vars] ansible_python_interpreter = "{{ kdevops_python_interpreter }}" {% endif %} +{% endif %}
playbooks/roles/gen_nodes/defaults/main.yml +1 -0
@@ -12,6 +12,7 @@ kdevops_workflow_enable_cxl: False kdevops_workflow_enable_pynfs: False kdevops_workflow_enable_gitr: False kdevops_workflow_enable_selftests: False +kdevops_nfsd_enable: False virtualbox_provider: False libvirt_provider: False
playbooks/roles/gen_nodes/tasks/main.yml +3 -3
@@ -47,13 +47,13 @@ set_fact: nfsd_nodes: "{{ [ kdevops_host_prefix + '-nfsd' ] }}" when: - - nfsd_threads is defined + - kdevops_nfsd_enable|bool - name: Add an nfs server if one was selected set_fact: generic_nodes: "{{ generic_nodes + nfsd_nodes }}" when: - - nfsd_threads is defined + - kdevops_nfsd_enable|bool - name: Set fstests config file variable for {{ fstests_fstyp }} set_fact:
@@ -215,7 +215,7 @@ fstests_enabled_nodes: "{{ fstests_enabled_nodes + nfsd_nodes }}" when: - is_fstests|bool - - nfsd_threads is defined + - kdevops_nfsd_enable|bool - name: Generate the fstests kdevops nodes file using {{ kdevops_nodes_template }} as jinja2 source template tags: [ 'hosts' ]
scripts/nfsd.Makefile +1 -0
@@ -6,6 +6,7 @@ NFSD_EXTRA_ARGS += nfsd_export_fstype='$(subst ",,$(CONFIG_NFSD_EXPORT_FSTYPE))' NFSD_EXTRA_ARGS += nfsd_export_path='$(subst ",,$(CONFIG_NFSD_EXPORT_PATH))' NFSD_EXTRA_ARGS += nfsd_threads=$(CONFIG_NFSD_THREADS) NFSD_EXTRA_ARGS += nfsd_lease_time=$(CONFIG_NFSD_LEASE_TIME) +NFSD_EXTRA_ARGS += kdevops_nfsd_enable=True EXTRA_VAR_INPUTS += extend-extra-args-nfsd
Signature · 1 line
2.43.0
PATCH v2 9/10 kconfigs: clean up Kconfig.bringup.goals
In reply to Scott MayhewMove 'config KDEVOPS_SETUP_NFSD' and 'menu "Configure the kernel NFS server"' out of Kconfig.bringup.goals and into Kconfig.nfsd. This is simply to keep the top level kconfigs cleaner.
--- kconfigs/Kconfig.bringup.goals | 12 ------------ kconfigs/Kconfig.nfsd | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 12 deletions(-)
kconfigs/Kconfig.bringup.goals +0 -12
@@ -96,16 +96,4 @@ config KDEVOPS_SETUP_KTLS authority, and configure tlshd on the hosts to use it. This is necessary for testing RPC over TLS, or NVMe over TCP. -config KDEVOPS_SETUP_NFSD - bool "Set up the kernel nfs server" - default n - help - Configure and bring up the kernel NFS server. This will provision - a filesystem on a block device, mount it, export it and start up the - nfs server and associated daemons. - -if KDEVOPS_SETUP_NFSD -menu "Configure the kernel NFS server" source "kconfigs/Kconfig.nfsd" -endmenu -endif
kconfigs/Kconfig.nfsd +16 -0
@@ -1,4 +1,16 @@ # FIXME: need defaults for terraform hosts +config KDEVOPS_SETUP_NFSD + bool "Set up the kernel nfs server" + default n + help + Configure and bring up the kernel NFS server. This will provision + a filesystem on a block device, mount it, export it and start up the + nfs server and associated daemons. + +if KDEVOPS_SETUP_NFSD + +menu "Configure the kernel NFS server" + config NFSD_EXPORT_DEVICE_PREFIX string "The device prefix to use for LVM PVs" default "/dev/disk/by-id/nvme-QEMU_NVMe_Ctrl_kdevops" if LIBVIRT && LIBVIRT_EXTRA_STORAGE_DRIVE_NVME
@@ -70,3 +82,7 @@ config NFSD_LEASE_TIME allow a large client cohort enough time to recover their open and lock state. But a shorter lease time helps certain tests complete faster. + +endmenu + +endif
Signature · 1 line
2.43.0
PATCH v2 10/10 fstests/nfs: add krb5 support
In reply to Scott MayhewThis adds the ability to run fstests on NFS with sec=krb5{,i,p}.
To use it, you need to:
* Specify a krb5 realm and admin password via:
-> Bring up goals
-> Set up KRB5
-> Configure the KRB5 KDC
-> KRB5 Realm
-> KRB5 admin password* Add the 'sec=' export option to nfsd via:
-> Bring up goals
-> Set up the kernel nfs server
-> Configure the kernel NFS server
-> The export options to use for the exported fs* Specify the auth flavor for the clients to use via:
-> Target workflows
-> Enable different target workflows
-> Enable selection of test workflows
-> Linux subsystem tests
-> Configure and run fstests
-> Configure how nfs should be tested
-> Authentication flavor to useThe following will happen during 'make bringup'
- a KDC will automatically be created
- the dependency packages for krb5 will be installed on the clients and nfsd
- keys will be created for the clients and nfsd on the KDC
- the keys will get added to the keytabs on the clients and nfsd
The auth flavor gets written to /etc/nfsmount.conf on the clients during 'make fstests'.
--- Makefile | 1 + kconfigs/Kconfig.bringup.goals | 1 + kconfigs/Kconfig.krb5 | 25 ++++ playbooks/kdc.yml | 4 + playbooks/krb5.yml | 4 + .../fstests/tasks/install-deps/suse/main.yml | 10 ++ playbooks/roles/fstests/tasks/main.yml | 41 ++++++ .../roles/fstests/templates/nfs/nfsmount.conf | 2 + playbooks/roles/gen_hosts/defaults/main.yml | 1 + .../roles/gen_hosts/templates/fstests.j2 | 15 +++ playbooks/roles/gen_nodes/defaults/main.yml | 1 + playbooks/roles/gen_nodes/tasks/main.yml | 19 +++ .../kdc/tasks/install-deps/debian/main.yml | 11 ++ .../roles/kdc/tasks/install-deps/main.yml | 12 ++ .../kdc/tasks/install-deps/redhat/main.yml | 16 +++ .../kdc/tasks/install-deps/suse/main.yml | 10 ++ playbooks/roles/kdc/tasks/main.yml | 119 ++++++++++++++++++ playbooks/roles/kdc/templates/kadm5.acl.j2 | 1 + playbooks/roles/kdc/templates/kdc.conf.j2 | 15 +++ playbooks/roles/kdc/templates/krb5.conf.j2 | 29 +++++ playbooks/roles/kdc/vars/Debian.yml | 7 ++ playbooks/roles/kdc/vars/RedHat.yml | 7 ++ playbooks/roles/kdc/vars/Suse.yml | 7 ++ playbooks/roles/kdc/vars/default.yml | 7 ++ playbooks/roles/kdc/vars/main.yml | 1 + .../krb5/tasks/install-deps/debian/main.yml | 9 ++ .../roles/krb5/tasks/install-deps/main.yml | 12 ++ .../krb5/tasks/install-deps/redhat/main.yml | 15 +++ .../krb5/tasks/install-deps/suse/main.yml | 16 +++ playbooks/roles/krb5/tasks/main.yml | 52 ++++++++ playbooks/roles/krb5/templates/krb5.conf.j2 | 31 +++++ .../nfsd/tasks/install-deps/debian/main.yml | 5 + .../nfsd/tasks/install-deps/suse/main.yml | 5 + scripts/krb5.Makefile | 22 ++++ workflows/fstests/nfs/Kconfig | 29 +++++ workflows/fstests/nfs/Makefile | 4 + 36 files changed, 566 insertions(+) create mode 100644 kconfigs/Kconfig.krb5 create mode 100644 playbooks/kdc.yml create mode 100644 playbooks/krb5.yml create mode 100644 playbooks/roles/fstests/templates/nfs/nfsmount.conf create mode 100644 playbooks/roles/kdc/tasks/install-deps/debian/main.yml create mode 100644 playbooks/roles/kdc/tasks/install-deps/main.yml create mode 100644 playbooks/roles/kdc/tasks/install-deps/redhat/main.yml create mode 100644 playbooks/roles/kdc/tasks/install-deps/suse/main.yml create mode 100644 playbooks/roles/kdc/tasks/main.yml create mode 100644 playbooks/roles/kdc/templates/kadm5.acl.j2 create mode 100644 playbooks/roles/kdc/templates/kdc.conf.j2 create mode 100644 playbooks/roles/kdc/templates/krb5.conf.j2 create mode 100644 playbooks/roles/kdc/vars/Debian.yml create mode 100644 playbooks/roles/kdc/vars/RedHat.yml create mode 100644 playbooks/roles/kdc/vars/Suse.yml create mode 100644 playbooks/roles/kdc/vars/default.yml create mode 100644 playbooks/roles/kdc/vars/main.yml create mode 100644 playbooks/roles/krb5/tasks/install-deps/debian/main.yml create mode 100644 playbooks/roles/krb5/tasks/install-deps/main.yml create mode 100644 playbooks/roles/krb5/tasks/install-deps/redhat/main.yml create mode 100644 playbooks/roles/krb5/tasks/install-deps/suse/main.yml create mode 100644 playbooks/roles/krb5/tasks/main.yml create mode 100644 playbooks/roles/krb5/templates/krb5.conf.j2 create mode 100644 scripts/krb5.Makefile
Makefile +1 -0
@@ -107,6 +107,7 @@ endif # CONFIG_WORKFLOWS include scripts/siw.Makefile include scripts/ktls.Makefile include scripts/nfsd.Makefile +include scripts/krb5.Makefile include scripts/devconfig.Makefile include scripts/ssh.Makefile
kconfigs/Kconfig.bringup.goals +1 -0
@@ -97,3 +97,4 @@ config KDEVOPS_SETUP_KTLS necessary for testing RPC over TLS, or NVMe over TCP. source "kconfigs/Kconfig.nfsd" +source "kconfigs/Kconfig.krb5"
kconfigs/Kconfig.krb5 new file +25 -0
@@ -0,0 +1,25 @@ +config KDEVOPS_SETUP_KRB5 + bool "Set up KRB5" + default n + help + Configure and bring up a MIT Kerberos V5 KDC. + +if KDEVOPS_SETUP_KRB5 + +menu "Configure the KRB5 KDC" + +config KRB5_REALM + string "KRB5 Realm" + default "KDEVOPS" + help + Kerberos realm to create. + +config KRB5_ADMIN_PW + string "KRB5 admin password" + default "kdevops" + help + Password to use for the 'root/admin' principal. + +endmenu + +endif
playbooks/kdc.yml new file +4 -0
@@ -0,0 +1,4 @@ +--- +- hosts: all + roles: + - role: kdc
playbooks/krb5.yml new file +4 -0
@@ -0,0 +1,4 @@ +--- +- hosts: all + roles: + - role: krb5
playbooks/roles/fstests/tasks/install-deps/suse/main.yml +10 -0
@@ -237,3 +237,13 @@ when: - repos_present|bool - fstests_fstyp == "nfs" + +- name: Ensure nfs-client.target is enabled + become: yes + become_method: sudo + ansible.builtin.systemd: + name: nfs-client.target + enabled: true + state: started + when: + - fstests_fstyp == "nfs"
playbooks/roles/fstests/tasks/main.yml +41 -0
47 lines not on this page · raw message
playbooks/roles/fstests/templates/nfs/nfsmount.conf new file +2 -0
@@ -0,0 +1,2 @@ +[ NFSMount_Global_Options ] +# Sec=sys
playbooks/roles/gen_hosts/defaults/main.yml +1 -0
@@ -32,3 +32,4 @@ fs_config_role_path: "/dev/null" fs_config_data: "[section_1]" kdevops_nfsd_enable: False +kdevops_krb5_enable: False
playbooks/roles/gen_hosts/templates/fstests.j2 +15 -0
@@ -27,3 +27,18 @@ ansible_python_interpreter = "{{ kdevops_python_interpreter }}" [nfsd:vars] ansible_python_interpreter = "{{ kdevops_python_interpreter }}" {% endif %} +{% if kdevops_krb5_enable %} +[kdc] +{{ kdevops_hosts_prefix }}-kdc +[kdc:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" +[krb5] +{% for s in fstests_enabled_test_types %} +{{ kdevops_host_prefix }}-{{ s }} +{% endfor %} +{% if kdevops_nfsd_enable %} +{{ kdevops_hosts_prefix }}-nfsd +{% endif %} +[krb5:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" +{% endif %}
playbooks/roles/gen_nodes/defaults/main.yml +1 -0
@@ -13,6 +13,7 @@ kdevops_workflow_enable_pynfs: False kdevops_workflow_enable_gitr: False kdevops_workflow_enable_selftests: False kdevops_nfsd_enable: False +kdevops_krb5_enable: False virtualbox_provider: False libvirt_provider: False
playbooks/roles/gen_nodes/tasks/main.yml +19 -0
@@ -55,6 +55,18 @@ when: - kdevops_nfsd_enable|bool +- name: Set kdc_nodes list + set_fact: + kdc_nodes: "{{ [ kdevops_host_prefix + '-kdc' ] }}" + when: + - kdevops_krb5_enable|bool + +- name: Add a KRB5 KDC if one was selected + set_fact: + generic_nodes: "{{ generic_nodes + kdc_nodes }}" + when: + - kdevops_krb5_enable|bool + - name: Set fstests config file variable for {{ fstests_fstyp }} set_fact: is_fstests: True
@@ -217,6 +229,13 @@ - is_fstests|bool - kdevops_nfsd_enable|bool +- name: Add the KRB5 KDC if one was selected + set_fact: + fstests_enabled_nodes: "{{ fstests_enabled_nodes + kdc_nodes }}" + when: + - is_fstests|bool + - kdevops_krb5_enable|bool + - name: Generate the fstests kdevops nodes file using {{ kdevops_nodes_template }} as jinja2 source template tags: [ 'hosts' ] vars:
playbooks/roles/kdc/tasks/install-deps/debian/main.yml new file +11 -0
@@ -0,0 +1,11 @@ +--- +- name: Install kdc dependencies + become: yes + become_method: sudo + apt: + name: + - krb5-admin-server + - krb5-kdc + - krb5-user + state: present + update_cache: yes
playbooks/roles/kdc/tasks/install-deps/main.yml new file +12 -0
@@ -0,0 +1,12 @@ +--- +- name: Debian-specific set up + ansible.builtin.include_tasks: roles/tasks/kdc/install-deps/debian/main.yml + when: ansible_os_family == 'Debian' + +- name: SuSE-specific set up + ansible.builtin.include_tasks: roles/tasks/kdc/install-deps/suse/main.yml + when: ansible_os_family == 'Suse' + +- name: Red Hat-specific set up + ansible.builtin.include_tasks: roles/tasks/kdc/install-deps/redhat/main.yml + when: ansible_os_family == 'RedHat'
playbooks/roles/kdc/tasks/install-deps/redhat/main.yml new file +16 -0
@@ -0,0 +1,16 @@ +--- +- name: Install kdc dependencies + become: yes + become_method: sudo + yum: + update_cache: yes + name: "{{ packages }}" + retries: 3 + delay: 5 + register: result + until: result.rc == 0 + vars: + packages: + - krb5-server + - krb5-libs + - krb5-workstation
playbooks/roles/kdc/tasks/install-deps/suse/main.yml new file +10 -0
@@ -0,0 +1,10 @@ +--- +- name: Install kdc dependencies + become: yes + become_method: sudo + zypper: + name: + - krb5 + - krb5-client + - krb5-server + state: present
playbooks/roles/kdc/tasks/main.yml new file +119 -0
119 lines not on this page · raw message
playbooks/roles/kdc/templates/kadm5.acl.j2 new file +1 -0
@@ -0,0 +1 @@ +*/admin@{{ krb5_realm }} *
playbooks/roles/kdc/templates/kdc.conf.j2 new file +15 -0
@@ -0,0 +1,15 @@ +[kdcdefaults] + kdc_ports = 88 + kdc_tcp_ports = 88 + spake_preauth_kdc_challenge = edwards25519 + +[realms] +{{ krb5_realm }} = { + database_name = {{ kdc_data_dir }}/principal + master_key_type = {{ kdc_master_key_type }} + acl_file = {{ kdc_data_dir }}/kadm5.acl + dict_file = /usr/share/dict/words + default_principal_flags = +preauth + admin_keytab = {{ kdc_data_dir }}/kadm5.keytab + supported_enctypes = {{ kdc_supported_enctypes }} +}
playbooks/roles/kdc/templates/krb5.conf.j2 new file +29 -0
@@ -0,0 +1,29 @@ +includedir /etc/krb5.conf.d/ + +[logging] + default = FILE:/var/log/krb5libs.log + kdc = FILE:/var/log/krb5kdc.log + admin_server = FILE:/var/log/kadmind.log + +[libdefaults] + dns_lookup_realm = false + ticket_lifetime = 24h + renew_lifetime = 7d + forwardable = true + rdns = false + pkinit_anchors = FILE:/etc/pki/tls/certs/ca-bundle.crt + spake_preauth_groups = edwards25519 + dns_canonicalize_hostname = fallback + qualify_shortname = "" + default_realm = {{ krb5_realm }} + default_ccache_name = KEYRING:persistent:%{uid} + +[realms] +{{ krb5_realm }} = { + kdc = {{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:88 + admin_server = {{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:749 +} + +[domain_realm] + .{{ krb5_realm | lower }} = {{ krb5_realm }} + {{ krb5_realm | lower }} = {{ krb5_realm }}
playbooks/roles/kdc/vars/Debian.yml new file +7 -0
@@ -0,0 +1,7 @@ +--- +kdc_conf_dir: /etc/krb5kdc +kdc_data_dir: /var/lib/krb5kdc +kdc_master_key_type: aes256-cts +kdc_supported_enctypes: aes256-cts:normal aes128-cts:normal +krb5kdc_service_name: krb5-kdc +kadmin_service_name: krb5-admin-server
playbooks/roles/kdc/vars/RedHat.yml new file +7 -0
@@ -0,0 +1,7 @@ +--- +kdc_conf_dir: /var/kerberos/krb5kdc +kdc_data_dir: /var/kerberos/krb5kdc +kdc_master_key_type: aes256-cts-hmac-sha384-192 +kdc_supported_enctypes: aes256-cts-hmac-sha384-192:normal aes128-cts-hmac-sha256-128:normal aes256-cts-hmac-sha1-96:normal aes128-cts-hmac-sha1-96:normal camellia256-cts-cmac:normal camellia128-cts-cmac:normal +krb5kdc_service_name: krb5kdc +kadmin_service_name: kadmin
playbooks/roles/kdc/vars/Suse.yml new file +7 -0
@@ -0,0 +1,7 @@ +--- +kdc_conf_dir: /var/lib/kerberos/krb5kdc +kdc_data_dir: /var/lib/kerberos/krb5kdc +kdc_master_key_type: aes256-cts +kdc_supported_enctypes: aes256-cts:normal aes128-cts:normal +krb5kdc_service_name: krb5kdc +kadmin_service_name: kadmind
playbooks/roles/kdc/vars/default.yml new file +7 -0
@@ -0,0 +1,7 @@ +--- +kdc_conf_dir: /var/kerberos/krb5kdc +kdc_data_dir: /var/kerberos/krb5kdc +kdc_master_key_type: aes256-cts-hmac-sha384-192 +kdc_supported_enctypes: aes256-cts-hmac-sha384-192:normal aes128-cts-hmac-sha256-128:normal aes256-cts-hmac-sha1-96:normal aes128-cts-hmac-sha1-96:normal camellia256-cts-cmac:normal camellia128-cts-cmac:normal +krb5kdc_service_name: krb5kdc +kadmin_service_name: kadmin
playbooks/roles/kdc/vars/main.yml new file +1 -0
@@ -0,0 +1 @@ +---
playbooks/roles/krb5/tasks/install-deps/debian/main.yml new file +9 -0
@@ -0,0 +1,9 @@ +--- +- name: Install krb5 dependencies + become: yes + become_method: sudo + apt: + name: + - krb5-user + state: present + update_cache: yes
playbooks/roles/krb5/tasks/install-deps/main.yml new file +12 -0
@@ -0,0 +1,12 @@ +--- +- name: Debian-specific set up + ansible.builtin.include_tasks: roles/tasks/krb5/install-deps/debian/main.yml + when: ansible_os_family == 'Debian' + +- name: SuSE-specific set up + ansible.builtin.include_tasks: roles/tasks/krb5/install-deps/suse/main.yml + when: ansible_os_family == 'Suse' + +- name: Red Hat-specific set up + ansible.builtin.include_tasks: roles/tasks/krb5/install-deps/redhat/main.yml + when: ansible_os_family == 'RedHat'
playbooks/roles/krb5/tasks/install-deps/redhat/main.yml new file +15 -0
@@ -0,0 +1,15 @@ +--- +- name: Install krb5 dependencies + become: yes + become_method: sudo + yum: + update_cache: yes + name: "{{ packages }}" + retries: 3 + delay: 5 + register: result + until: result.rc == 0 + vars: + packages: + - krb5-libs + - krb5-workstation
playbooks/roles/krb5/tasks/install-deps/suse/main.yml new file +16 -0
@@ -0,0 +1,16 @@ +--- +- name: Install krb5 dependencies + become: yes + become_method: sudo + zypper: + name: + - krb5 + - krb5-client + - kernel-default + state: present + force_resolution: true + +- name: Reboot system to make the new kernel and modules take effect + become: yes + become_method: sudo + ansible.builtin.reboot:
playbooks/roles/krb5/tasks/main.yml new file +52 -0
52 lines not on this page · raw message
playbooks/roles/krb5/templates/krb5.conf.j2 new file +31 -0
@@ -0,0 +1,31 @@ +includedir /etc/krb5.conf.d/ + +[logging] + default = FILE:/var/log/krb5libs.log + kdc = FILE:/var/log/krb5kdc.log + admin_server = FILE:/var/log/kadmind.log + +[libdefaults] + dns_lookup_realm = false + ticket_lifetime = 24h + renew_lifetime = 7d + forwardable = true + rdns = false + pkinit_anchors = FILE:/etc/pki/tls/certs/ca-bundle.crt + spake_preauth_groups = edwards25519 + dns_canonicalize_hostname = fallback + qualify_shortname = "" + default_realm = {{ krb5_realm }} + default_ccache_name = KEYRING:persistent:%{uid} + +[realms] +{{ krb5_realm }} = { + kdc = {{ kdevops_hosts_prefix }}-kdc:88 + admin_server = {{ kdevops_hosts_prefix }}-kdc:749 + auth_to_local = RULE:[2:$1;$2](^nfs;.*$)s/^.*$/root/ + auth_to_local = DEFAULT +} + +[domain_realm] + .{{ krb5_realm | lower }} = {{ krb5_realm }} + {{ krb5_realm | lower }} = {{ krb5_realm }}
playbooks/roles/nfsd/tasks/install-deps/debian/main.yml +5 -0
@@ -21,6 +21,11 @@ - fsprogs is defined - fsprogs +- name: Add gssproxy to the nfsd packages list + set_fact: + nfsd_packages: "{{ nfsd_packages + ['gssproxy'] }}" + when: kdevops_krb5_enable|bool + - name: Install nfsd dependencies become: yes become_method: sudo
playbooks/roles/nfsd/tasks/install-deps/suse/main.yml +5 -0
@@ -21,6 +21,11 @@ - fsprogs is defined - fsprogs +- name: Add additional packages needed for krb5 to the nfsd packages list + set_fact: + nfsd_packages: "{{ nfsd_packages + ['gssproxy', 'libverto-libev1'] }}" + when: kdevops_krb5_enable|bool + - name: Install nfsd dependencies become: yes become_method: sudo
scripts/krb5.Makefile new file +22 -0
@@ -0,0 +1,22 @@ +ifeq (y,$(CONFIG_KDEVOPS_SETUP_KRB5)) + +KRB5_EXTRA_ARGS += krb5_realm='$(subst ",,$(CONFIG_KRB5_REALM))' +KRB5_EXTRA_ARGS += krb5_admin_pw='$(subst ",,$(CONFIG_KRB5_ADMIN_PW))' +KRB5_EXTRA_ARGS += kdevops_krb5_enable=True + +ANSIBLE_EXTRA_ARGS += $(KRB5_EXTRA_ARGS) + +kdc: + $(Q)ansible-playbook $(ANSIBLE_VERBOSE) --extra-vars=@./extra_vars.yaml \ + -f 30 -i hosts -l kdc playbooks/kdc.yml + +krb5: + $(Q)ansible-playbook $(ANSIBLE_VERBOSE) --extra-vars=@./extra_vars.yaml \ + -f 30 -i hosts -l krb5 playbooks/krb5.yml + +KDEVOPS_BRING_UP_DEPS += kdc +KDEVOPS_BRING_UP_LATE_DEPS += krb5 + +PHONY += kdc krb5 + +endif
workflows/fstests/nfs/Kconfig +29 -0
@@ -98,3 +98,32 @@ config FSTESTS_NFS_SECTION_V3 default n endif # !FSTESTS_NFS_MANUAL_COVERAGE + +choice + prompt "Authentication flavor to use" + default FSTESTS_NFS_AUTH_KRB5 + depends on KDEVOPS_SETUP_KRB5 + help + This is the authentication flavor you want to test. The selected + option will get written to /etc/nfsmount.conf on the NFS clients. + +config FSTESTS_NFS_AUTH_SYS + bool "sys" + +config FSTESTS_NFS_AUTH_KRB5 + bool "krb5" + +config FSTESTS_NFS_AUTH_KRB5I + bool "krb5i" + +config FSTESTS_NFS_AUTH_KRB5P + bool "krb5p" + +endchoice + +config FSTESTS_NFS_AUTH_FLAVOR + string + default "sys" if FSTESTS_NFS_AUTH_SYS + default "krb5" if FSTESTS_NFS_AUTH_KRB5 + default "krb5i" if FSTESTS_NFS_AUTH_KRB5I + default "krb5p" if FSTESTS_NFS_AUTH_KRB5P
workflows/fstests/nfs/Makefile +4 -0
@@ -24,3 +24,7 @@ endif ifeq (y,$(CONFIG_FSTESTS_NFS_SECTION_V3)) FSTESTS_ARGS += fstests_nfs_section_v3=True endif + +ifdef CONFIG_FSTESTS_NFS_AUTH_FLAVOR +FSTESTS_ARGS += fstests_nfs_auth_flavor='$(subst ",,$(CONFIG_FSTESTS_NFS_AUTH_FLAVOR))' +endif
Signature · 1 line
2.43.0
Quoted 129 lines · Scott Mayhew
These patches add support for running fstests on NFS with krb5. There are numerous other fixes and cleanups, but the bulk of the work is in patch 10.
There are a handful of new
Kconfigoptions (KDEVOPS_SETUP_KRB5,KRB5_REALM,KRB5_ADMIN_PW, andFSTESTS_NFS_AUTH_FLAVOR) as well as some newMakefiletargets ("kdc" and "krb5", both of which get executed automatically). During "make bringup", a KDC is spun up automatically, and all the necessary package dependencies are installed, keys are generated, and the keytabs are updated on the NFS client and server VMs.Right now you can only use krb5 with the fstests workflow, but it should be straightforward to add it to the other NFS-related workflows.
-Scott
Changes since v1:
- Added a pipefs-directory config in nfs.conf to fix a debian issue.
- Movedupdate_etc_hoststarget to run as an early bringup dependency.
- Cleaned up the top levelMakefileand bringup.Makefile by moving some directives into lower level makefiles for nfsd, ktls, siw, and krb5.
- Added akdevops_nfsd_enablevariable and use that instead of checking ifnfsd_threadsis defined in several places.
- Cleaned up the hosts file by making sure "nfsd" and "nfsd:vars" stanzas do not get created if nfsd isn't enabled.
- Cleaned up the hosts file by making sure "krb5", "krb5:vars", "kdc", and "kdc:vars" stanzas do not get created if krb5 isn't enabled.
- Cleaned upKconfig.bringup.goalsby moving some directives into lower level kconfigs for nfsd and krb5.
- Added akdevops_krb5_enablevariable and use that instead of checking ifkrb5_realmis defined in several places.
- Folded the kdc.Makefile into the krb5.Makefile (there's no reason for them to have two separate makefiles).
- Added some default vars settings for the KDC.
- Got rid of some unnecessary tasks in the krb5 role that check to see if a principal existed before creating it, and also before adding it to the keytab (in reality these checks were just triggering errors that needed to be ignored).
- Forced the restart rpc.gssd task in the krb5 role to only run on the nfsd server (because rpc.gssd isn't installed on the clients yet at the point when the krb5 role is executed).
- Made the krb5 target to run automatically as a late bringup dependency.Scott Mayhew (10):
nfsd: make sure the appropriate fsprogs package is installed
update_etc_hosts: fix up hostnames on debian guestfs hosts
nfsd: useEXTRA_VAR_INPUTSfor export options
devconfig: set/etc/hostnameearlier
nfsd: add a pipefs-directory config to nfs.conf
bringup: move theupdate_etc_hoststask to run early
bringup: clean up the nfs-related make targets gen_hosts/gen_nodes: clean up nfsd-related stuff
kconfigs: clean upKconfig.bringup.goalsfstests/nfs: add krb5 supportMakefile | 10 +- kconfigs/Kconfig.bringup.goals | 13 +- kconfigs/Kconfig.krb5 | 25 ++++ kconfigs/Kconfig.nfsd | 16 +++ playbooks/kdc.yml | 4 + playbooks/krb5.yml | 4 + playbooks/roles/devconfig/tasks/main.yml | 21 ++-- .../fstests/tasks/install-deps/suse/main.yml | 10 ++ playbooks/roles/fstests/tasks/main.yml | 41 ++++++ .../roles/fstests/templates/nfs/nfsmount.conf | 2 + playbooks/roles/gen_hosts/defaults/main.yml | 3 + .../roles/gen_hosts/templates/fstests.j2 | 19 ++- playbooks/roles/gen_hosts/templates/gitr.j2 | 4 +- playbooks/roles/gen_hosts/templates/hosts.j2 | 6 +- playbooks/roles/gen_nodes/defaults/main.yml | 2 + playbooks/roles/gen_nodes/tasks/main.yml | 25 +++- .../kdc/tasks/install-deps/debian/main.yml | 11 ++ .../roles/kdc/tasks/install-deps/main.yml | 12 ++ .../kdc/tasks/install-deps/redhat/main.yml | 16 +++ .../kdc/tasks/install-deps/suse/main.yml | 10 ++ playbooks/roles/kdc/tasks/main.yml | 119 ++++++++++++++++++ playbooks/roles/kdc/templates/kadm5.acl.j2 | 1 + playbooks/roles/kdc/templates/kdc.conf.j2 | 15 +++ playbooks/roles/kdc/templates/krb5.conf.j2 | 29 +++++ playbooks/roles/kdc/vars/Debian.yml | 7 ++ playbooks/roles/kdc/vars/RedHat.yml | 7 ++ playbooks/roles/kdc/vars/Suse.yml | 7 ++ playbooks/roles/kdc/vars/default.yml | 7 ++ playbooks/roles/kdc/vars/main.yml | 1 + .../krb5/tasks/install-deps/debian/main.yml | 9 ++ .../roles/krb5/tasks/install-deps/main.yml | 12 ++ .../krb5/tasks/install-deps/redhat/main.yml | 15 +++ .../krb5/tasks/install-deps/suse/main.yml | 16 +++ playbooks/roles/krb5/tasks/main.yml | 52 ++++++++ playbooks/roles/krb5/templates/krb5.conf.j2 | 31 +++++ .../nfsd/tasks/install-deps/debian/main.yml | 33 ++++- .../nfsd/tasks/install-deps/redhat/main.yml | 31 +++-- .../nfsd/tasks/install-deps/suse/main.yml | 32 ++++- playbooks/roles/nfsd/templates/nfs.conf.j2 | 3 + playbooks/roles/nfsd/vars/Debian.yml | 13 ++ playbooks/roles/nfsd/vars/RedHat.yml | 14 +++ playbooks/roles/nfsd/vars/Suse.yml | 12 ++ .../roles/update_etc_hosts/tasks/main.yml | 26 +++- playbooks/update_etc_hosts.yml | 1 + scripts/bringup.Makefile | 19 +-- scripts/krb5.Makefile | 22 ++++ scripts/ktls.Makefile | 7 ++ scripts/nfsd.Makefile | 17 ++- scripts/siw.Makefile | 6 + scripts/update_etc_hosts.Makefile | 7 ++ workflows/fstests/nfs/Kconfig | 29 +++++ workflows/fstests/nfs/Makefile | 4 + 52 files changed, 778 insertions(+), 80 deletions(-) create mode 100644 kconfigs/Kconfig.krb5 create mode 100644 playbooks/kdc.yml create mode 100644 playbooks/krb5.yml create mode 100644 playbooks/roles/fstests/templates/nfs/nfsmount.conf create mode 100644 playbooks/roles/kdc/tasks/install-deps/debian/main.yml create mode 100644 playbooks/roles/kdc/tasks/install-deps/main.yml create mode 100644 playbooks/roles/kdc/tasks/install-deps/redhat/main.yml create mode 100644 playbooks/roles/kdc/tasks/install-deps/suse/main.yml create mode 100644 playbooks/roles/kdc/tasks/main.yml create mode 100644 playbooks/roles/kdc/templates/kadm5.acl.j2 create mode 100644 playbooks/roles/kdc/templates/kdc.conf.j2 create mode 100644 playbooks/roles/kdc/templates/krb5.conf.j2 create mode 100644 playbooks/roles/kdc/vars/Debian.yml create mode 100644 playbooks/roles/kdc/vars/RedHat.yml create mode 100644 playbooks/roles/kdc/vars/Suse.yml create mode 100644 playbooks/roles/kdc/vars/default.yml create mode 100644 playbooks/roles/kdc/vars/main.yml create mode 100644 playbooks/roles/krb5/tasks/install-deps/debian/main.yml create mode 100644 playbooks/roles/krb5/tasks/install-deps/main.yml create mode 100644 playbooks/roles/krb5/tasks/install-deps/redhat/main.yml
Quoted 9 lines
create mode 100644 playbooks/roles/krb5/tasks/install-deps/suse/main.yml create mode 100644 playbooks/roles/krb5/tasks/main.yml create mode 100644 playbooks/roles/krb5/templates/krb5.conf.j2 create mode 100644 playbooks/roles/nfsd/vars/Debian.yml create mode 100644 playbooks/roles/nfsd/vars/RedHat.yml create mode 100644 playbooks/roles/nfsd/vars/Suse.yml create mode 100644 scripts/krb5.Makefile create mode 100644 scripts/update_etc_hosts.Makefile
This all looks good to me.
Quoted 11 lines · Scott Mayhew
These patches add support for running fstests on NFS with krb5. There are numerous other fixes and cleanups, but the bulk of the work is in patch 10.
There are a handful of new
Kconfigoptions (KDEVOPS_SETUP_KRB5,KRB5_REALM,KRB5_ADMIN_PW, andFSTESTS_NFS_AUTH_FLAVOR) as well as some newMakefiletargets ("kdc" and "krb5", both of which get executed automatically). During "make bringup", a KDC is spun up automatically, and all the necessary package dependencies are installed, keys are generated, and the keytabs are updated on the NFS client and server VMs.
Quoted 2 lines
Right now you can only use krb5 with the fstests workflow, but it should be straightforward to add it to the other NFS-related workflows.
Looks super sexy now:
Luis