vos-release: fix sudo

If you read the man page

 # This will cause sudo to read and parse any files in the /etc/sudoers.d
 # directory that do not end in '~' or contain a '.' character.

I don't know why sudo doesn't like files with a ".", but remove it

Fix the syntax in this file which has too many spaces

The theory that specifying a command means you can have nologin as
shell is debunked; change the shell to /bin/bash

 root@mirror-update01:~# ssh -i ~/.ssh/id_vos_release vos_release@afs01.dfw.openstack.org vos
 This account is currently not available.

Don't use shortcuts for positional parameters, suggested by jaltmann
in If70b27cb974eb8c1bafec2b7ef86d4f5cba3c4c5.

After hand applying these fixes, I can log in and run the script as
expected.

Change-Id: I058aadaa5ca5c7b8e94b275c4b8d26e1e0688ce8
This commit is contained in:
Ian Wienand 2019-11-21 14:11:42 +11:00
parent f57154f91b
commit a6a4e5dfe5
3 changed files with 4 additions and 4 deletions

View File

@ -12,6 +12,6 @@ if [[ $# != 3 || $1 != "vos" || $2 != "release" ]]; then
exit 1
fi
sudo vos release -v -localauth $3
sudo vos release -id $3 -verbose -localauth

View File

@ -1 +1 @@
vos_release ALL = (ALL) NOPASSWD: /usr/bin/vos
vos_release ALL=(ALL) NOPASSWD: /usr/bin/vos

View File

@ -9,7 +9,7 @@
- name: Install sudo permissions
copy:
src: vos_release.sudo
dest: '/etc/sudoers.d'
dest: '/etc/sudoers.d/vos_release'
owner: root
group: root
mode: 0440
@ -18,7 +18,7 @@
user:
name: vos_release
comment: Remote user for "vos release"
shell: /usr/sbin/nologin
shell: /bin/bash
- name: Ensure update key exists
assert: