1
0
mirror of https://github.com/slicer69/doas synced 2024-07-03 07:58:51 +00:00
Commit Graph

111 Commits

Author SHA1 Message Date
Jesse Smith
3b3aef99a1 Fixed error where doas could try to run doas again. 2021-01-25 14:25:28 -04:00
Jesse Smith
b69b314bc1 Merge branch 'master' of https://github.com/slicer69/doas 2021-01-25 14:14:21 -04:00
Jesse Smith
5ac8a3968a Updated vidoas to set ownership of doas.conf file to avoid
ownership changing on macOS.
2021-01-25 14:09:16 -04:00
Jesse Smith
4becfe1567 Updated READMe to fix typo 2020-12-07 12:35:30 -04:00
Jesse Smith
63cfc9f3c8 Updated install instructiosn for Arch and FreeBSD. Placed
these together above source install instructions.
2020-12-07 12:34:25 -04:00
Jesse Smith
1d5696c2db
Merge pull request #55 from scrouthtv/patch-1
Update README.md
2020-12-07 12:29:44 -04:00
scrouthtv
4b31fca816
Update README.md 2020-12-07 17:23:21 +01:00
scrouthtv
1382a91f77
Update README.md 2020-12-07 16:57:15 +01:00
scrouthtv
d966e5a2fd
Update README.md
Added note to the AUR version
2020-12-07 10:17:49 +01:00
Jesse Smith
dee40ceb0b Fixed missing "args" parameter in sample configuration file. 2020-11-25 16:56:22 -04:00
Jesse Smith
fde6db11d4
Merge pull request #53 from b1rger/patch-1
Fix typo
2020-11-11 14:24:33 -04:00
Birger Schacht
e30fafe6fd
Fix typo 2020-11-11 17:41:39 +00:00
Jesse Smith
f82b712c16 Added syntax check for file passed to vidoas
script using -n flag.

Restored vidoas script to /usr/local/bin/ from /usr/local/sbin/
to insure it is in common user path.
2020-11-09 11:30:49 -04:00
Jesse Smith
8c19f6a4b3
Merge pull request #51 from suominen/vidoas
vidoas: Allow specifying file to edit. Add manual page and license.
2020-11-09 11:04:19 -04:00
Kimmo Suominen
f807ff888d Account correctly for the -h option 2020-11-09 11:54:04 +02:00
Kimmo Suominen
b4b963a130 vidoas: Allow specifying file to edit. Add manual page and license.
- Add functionality to edit a file specified on the command line.
- Add `-n` option for running prerequisite checks without editing the
  configuration file.
- Install vidoas in `@PREFIX@/sbin` as it is really more of a system
  maintenance command (run by administrators; requires root privileges
  for editing the default **doas(1)** configuation file).
- Add a manual page (in section `8`).
- Release the code under the same MIT-like license as **doas(1)**
  itself.
2020-11-09 11:43:46 +02:00
Jesse Smith
a543abb656
Merge pull request #50 from suominen/vidoas
Avoid unnecessary doas.conf race
2020-11-08 19:17:33 -04:00
Kimmo Suominen
1872e46dea Avoid repeating the substitution recipe
- Define the recipe once, and list prerequisites for each target in
  separate rules.
- Also use cat(1) in the recipe in case there are multiple prerequisites
  for some target in the future.
2020-11-09 00:52:20 +02:00
Kimmo Suominen
2ab4f7df96 Add missing dependencies for install target 2020-11-09 00:23:11 +02:00
Kimmo Suominen
7648f25667 Install doas.conf safely. Define DOAS_CONF only once.
- Use mv(1) to install doas.conf to avoid writing a configuration file
  while other processes might be reading it.
- Define the DOAS_CONF path once in Makefile and pass that to the
  substitutions instead of recreating the full path independently in
  multiple files.
- Add a separate rule for building the doas binary, instead of creating
  it in the "all" target.  This avoids some unnecessary re-linking.
2020-11-09 00:12:50 +02:00
Jesse Smith
e2a5c3f5f7 Added warning about implicit versus explicity rules in
the doas.conf manual page.
2020-11-07 17:04:16 -04:00
Jesse Smith
eca76b6339 Minor update to vidoas script to avoid "-r" flag in stal
command which does not appear to be portable outside NetBSD.
2020-11-01 19:37:02 -04:00
Jesse Smith
eb91299578
Merge pull request #46 from suominen/vidoas
vidoas: Address security concerns and improve some behaviour
2020-11-01 19:31:15 -04:00
Kimmo Suominen
f2894542a6 vidoas: Address security concerns and improve some behaviour
I'm not claiming this script is now safe. It would certainly benefit
from additional review. I do think (and hope) that I did not make things
worse, at least.

It might be better to look at vipw(8) or visudo(8), which both are
written in C, for prior art on how to do this kind of thing securely.

Security changes:

- Exit on errors and if referencing unset variables.

- Set PATH so that we don't run unintended commands from the PATH that
  is in the caller's environment.

- Set umask to prevent other users from having write access to the
  temporary files.

- Use /var/tmp instead of /tmp, as /tmp is not shared between users on
  all systems. (So trying to install a file from /tmp as root would not
  find the file, if the user running vidoas is not root.)

  XXX: Using /var/tmp does not guarantee this either, but is more likely
  to work.

- Create a temporary file for editing and use ln(1) to acquire the lock.
  This addresses a race condition between checking for the lock file and
  creating it.

- Use "install -r" to avoid a truncated doas.conf from existing as would
  happen with cp (or install without the "-r" option).

  XXX: "install -r" is not portable.

- Use "install -m" to set the mode of the installed doas.conf file.

Changes to user experience:

- Don't check for executability of ${EDITOR} as it is not required to be
  an absolute path to the executable.

- Don't install an unchanged doas.conf file.

- Don't install an empty doas.conf file.

- The above two checks result in a no-op in the case that ${EDITOR}
  could not be run.

- Present the user with a choice of fixing errors or canceling changes.

- Output diagnostic messages to stderr (just like other tools do, e.g.
  doas, ln, and cp).

TODO:

- Avoid using hard-coded paths (/usr/local/bin and /usr/local/etc).
  They should be replaced with @PREFIX@/bin and @SYSCONFDIR@ before
  installing.
2020-10-22 11:23:56 +03:00
Jesse Smith
1bc08d470c
Merge pull request #45 from suominen/netbsd
doas: Use setusercontext(3) on NetBSD
2020-10-21 15:05:52 -03:00
Kimmo Suominen
ca5d5ec8bb doas: Use setusercontext(3) on NetBSD
Calling setusercontext(3) makes per-user temporary storage work (see
per_user_tmp in security(7) and rc.conf(5)).

May as well also use reallocarray(3) from libc instead of the bundled
compat code.
2020-10-21 20:37:51 +03:00
Jesse Smith
6f6d40fa69
Merge pull request #43 from MikaelUrankar/patch-1
Update doas.conf.sample
2020-10-05 07:50:52 -03:00
MikaelUrankar
39184fa510
Update doas.conf.sample
typo fix
2020-10-05 09:36:35 +02:00
Jesse Smith
5f849e8f45
Update README.md 2020-08-23 21:23:37 -03:00
Jesse Smith
e2a58270f1
Merge pull request #41 from keblek/patch-1
Update installation guides
2020-08-23 21:22:26 -03:00
keblek
a2592494ba
Update installation guides
Added command to get it to compile on Ubuntu, probably works on debian but I didn't test it
2020-08-24 01:50:29 +02:00
Jesse Smith
f595b9a35e Updated Makefile with uninstall instructions for doas. Removes
doas, vidoas, the doas manual page, and doas.conf manual page.
The doas.conf file is left on the system, if it exists.
2020-08-18 12:34:39 -03:00
Jesse Smith
08872e70c9 Added explanation of what vidoas does to the top of the script. 2020-08-07 18:42:52 -03:00
Jesse Smith
0d53f98938 Updated doas.conf.5 manual page to include mention of the vidoas script. 2020-08-07 18:41:41 -03:00
Jesse Smith
e4d73c97a3 Added a new shell script called vidoas. This script creates a temporary
version of the doas.conf file. Then allows the user to edit it.
The new configuration file is checked for syntax and then, if it passes,
is installed on the system. If the syntax check fails the user is asked
to fix any errors.
2020-08-07 18:18:40 -03:00
Jesse Smith
04b377f6fd On Linux doas no longer requires the user to specify the double-dash (--)
prior to a command that accepts arguments. Patch provided by Martijn
van Duren.
2020-08-06 15:17:09 -03:00
Jesse Smith
d49ac8e10c
Merge pull request #36 from helmat/master
Add option for full login
2020-06-21 11:08:22 -03:00
helmat
4702702752
Update doas.1 2020-06-21 15:31:05 +02:00
helmat
93a56843e4
Update doas.c 2020-06-21 15:29:37 +02:00
Jesse Smith
0a04433044
Update README.md 2020-06-07 14:40:45 -03:00
Jesse Smith
47f7dc7b3e
Added fix for CentOS installs
Added fix for CentOS (and related distros) where doas is prevented from using PAM to authenticate.
2020-06-07 14:39:46 -03:00
Jesse Smith
11a7ea1824 Added pam.conf.freebsd example file in the compat
directory to enable PAM configuration
on FreeBSD and related operating systems.
2020-04-20 19:52:48 -03:00
Jesse Smith
f2a55eb049 Updated macOS install instructions to make sure PAM configuration works as expected. 2020-02-06 22:58:12 -04:00
Jesse Smith
3f69b3e4f5 Aded sample doas.conf file.
Closes GitHub issue #29
2020-01-04 19:56:46 -04:00
Jesse Smith
5cd77cea5f Made sure parse.o is cleaned up. 2019-12-27 22:16:17 -04:00
Jesse Smith
a006f46031 On some platforms (seemingly Linux and macOS) it is possible for
repeated calls to getpwuid() can over-write the original struct passwd
strucuture. This can lead to the original user's environment data
being overwritten by the target user's, even when "keepenv" is
specified in the doas.conf file.

We now do a deep copy of the original and target users' struct passwd
information to avoid over-writting the original on platforms where libc
uses a static area for all calls.
2019-12-27 22:10:57 -04:00
Jesse Smith
f88bb2e8c4
Merge pull request #27 from ng-0/fix-pkg54717
manpages: patch in the correct installed location of the config file.
2019-11-28 12:50:46 -04:00
ng0
dad0c10232 manpages: patch in the correct installed location of the config file.
This resolves http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54717
2019-11-28 10:17:11 +00:00
Jesse Smith
ebd62ce4ae
Merge pull request #25 from gbergling/master
Add support for building doas on macOS Catalina
2019-10-12 12:07:28 -03:00
Gordon Bergling
989da8fc41 Fix Typo in README 2019-10-12 11:26:10 +02:00