Bugzilla – Bug 776
Including file beginning with an "i" removed first 3 characters
Last modified: 2017-05-10 10:35:06 MDT
If you add an include statement for a file beginning with the letter i the first 3 characters will be removed and a validation error will occur. As an example, assume you create a file called /etc/itest and include it in your sudoers file using: #include itest If you add the above line using visudo it will prompt you to press enter to edit /etc/st. When you edit the file it will save it to the prompted name and not the included file. If you remove the /etc/st file then run a visudo -c it will print an error that file /etc/st file doesn't exist. Running any of the commands in the included file will also fail and they won't display in a sudo -l. If you add the same file to an included directory, e.g. /etc/sudoers.d, then the file will work as expected. Tested against 1.8.6 & 1.8.19.
Nice catch, I'm verifying a fix now.
Created attachment 488 [details] Fix for including files that start with the letter 'i'
I've committed the fix: https://www.sudo.ws/repos/sudo/rev/4d9691a43867
Hi Todd, Yes, strange that this hasn't been reported before as I can't imagine I'm the first to encounter it. Anyway, I've downloaded, compiled and tested the patch and I can confirm that the issue is resolved for me. Keep up the good work, Robin
Also, a workaround is to use a fully-qualified path, e.g. #include /etc/itest
Fixed in sudo 1.8.20, available now.