Commit graph

31 commits

Author SHA1 Message Date
Lucas Holt 5e7dab5420 Add MidnightBSD support. 2021-09-13 15:56:17 -04:00
Jesse Smith 722ec966db Added new utility called doasedit which allows the user to edit
a text file using an editor running with normal access. Then
saves the file with admin/doas access.
Acts as an alternative to sudoedit.
2021-09-13 15:13:57 -03: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
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
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
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 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 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 5cd77cea5f Made sure parse.o is cleaned up. 2019-12-27 22:16:17 -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
Gordon Bergling b275ba2e56 Add support for building doas on macOS Catalina
- Adjust the Makefile and the README for macOS / Darwin specific build instructions
- Add bsd-closefrom.c as a more portable version of closefrom(2), which was
  obtained from the portable version of OpenSSH 8.1
2019-10-12 11:20:02 +02:00
Jesse Smith 705dd9ce24 Reorganized compatibility code and Makefile.
- amalleo25
Provided cleaner fix for crash when user/command has
no valid match in the doas.conf file.
- amalleo25
Removed option to match UID with -u flag. Provided
usernames must now match a username, not UID. This was
ambigious if a user had a numeric username.
- Jesse
2019-09-10 13:56:32 -03:00
Jesse Smith 2f83222829 Added optimization to Makefile (can be set/overruled using OPT).
Added flag to display all warnings during compiling.
Added status checks when parsing user/group IDs for Linux.
Make sure Linux drops original user's groups when running as another user.
2019-09-03 11:42:27 -03:00
Adam Malleo 9c53fdeb0b Add support for illumos 2019-09-02 12:37:58 -04:00
ng0 5bef71c735 Makefile: Add DESTDIR, MANDIR, and SYSCONFDIR variables. 2019-08-20 17:05:34 +00:00
Jesse Smith 8e9c2bde06 Removed the transfer of most environment variables, such as USER, HOME,
and PATH from the original user to the target user. This could cause
files in the wrogn path or home directory to be read (or written to),
which resulted in potential security problems.

This has been changed so that only DISPLAY and TERM are passed to the
new environment. This is fine for running command line programs. When
GUI programs need to be run, "keepenv" can be added to the user's
doas.conf entry. This results in variables like HOME being copied
to the target user, allowing GUI programs to run.

Many thanks to Sander Bos for reporting this issue and explaining
how it can be exploited.

This commit also adds the ability to pass a customized PATH to
target users. The new PATH can be set at compile time in the
Makefile. The default path is provided in the Makefile and commented
out.
2019-08-03 17:39:15 -03:00
Jesse Smith 1f76dd9515 Enabled doas to compile and run on NetBSD 8.1. 2019-06-24 19:15:03 -03:00
Jesse Smith c8cb4d999e Avoid echoing stdin when output is piped to doas.
Fix asprintf() compile warning when building on Linux.
2019-03-10 19:11:40 -03:00
Jesse Smith 4bd6c1c178 Fixed issue with port of doas searching the user's full path for
commands matching the "cmd" parameter in doas.conf. The path
should be shortened to system-standard paths. This prevents
the user from injecting their own application with a familiar
name in their PATH variable and tricking doas into running it.
2017-09-05 21:40:47 -03:00
Tobias Kortkamp 7ab94a448a Restore old behavior on Linux which was broken by the last commit
Small change in the Makefile so doas compiles on Ubuntu 16.04
2016-11-03 21:28:20 +01:00
Tobias Kortkamp 08dab0cd9c Use setusercontext on FreeBSD and get rid of the geteuid/setuid workaround 2016-09-17 02:15:40 +02:00
Jesse Smith 47b4ab919a Linux port now compiles and runs. Properly authenticates. 2016-06-26 14:34:33 -03:00
Jesse Smith cdf69cb5f5 This commit allows doas to compile on Linux. Does not authenticate yet. 2016-06-26 11:41:31 -03:00
Jesse Smith f3958f04ad Added reallocarray.c to Makefile to insure it compiles. 2016-06-24 10:06:43 -03:00
Tobias Kortkamp aea70ce4ea Apply patches from security/doas port 2016-06-24 13:42:00 +02:00
Tobias Kortkamp 0e2179b92e Simplify Makefile and respect CFLAGS and LDFLAGS from environment 2016-06-24 13:38:10 +02:00
Tobias Kortkamp 64ab988d34 Change realloc() back to reallocarray() 2016-06-24 13:29:08 +02:00
User Jesse e6f145622d Removed unused reallocarr.c file and removed references to it from Makefile.
Fixed typo in parse.y which used + instead of * when calculating memory usage.
2016-06-22 22:59:03 +00:00
Jesse Smith d55af6cdf4 This is the initial port of doas to FreeBSD. It compiles, installs and works.
Could probably use a clean-up, but this code is functional on FreeBSD 10.3.
2016-06-22 12:21:34 -03:00