sudoedit for doas users
  • Shell 80.3%
  • Makefile 19.7%
Find a file
2025-09-04 22:18:33 -04:00
.gitignore Revamped script design 2025-09-03 16:04:34 -04:00
.shellcheckrc Added some setup automation for building the script 2025-09-04 22:04:39 -04:00
doasedit_client.sh Seperated doasedit script out into smaller components 2025-09-04 22:06:39 -04:00
doasedit_common.sh Seperated doasedit script out into smaller components 2025-09-04 22:06:39 -04:00
doasedit_main.sh Seperated doasedit script out into smaller components 2025-09-04 22:06:39 -04:00
doasedit_order.sh Seperated doasedit script out into smaller components 2025-09-04 22:06:39 -04:00
doasedit_server.sh Seperated doasedit script out into smaller components 2025-09-04 22:06:39 -04:00
LICENSE.md Licensed under the OSL v3 2025-06-27 12:43:42 -04:00
Makefile Added some setup automation for building the script 2025-09-04 22:04:39 -04:00
README.md Added warning of incomplete status 2025-09-04 22:18:33 -04:00

Doasedit

Note doasedit is currently incomplete (unusable) do not try to use it right now

Doasedit is a sudoedit replacement written for Duncaen/OpenDoas written for posix compliant scripting environments. It uses a co-process to handle the entire request with a single doas invocation (as opposed to most applications requiring multiple invocations).

Usage

doasedit [-C[x]] [-nh] [-e[ ]<editor>] [-u[ ]<user>] <path/to/file>

Options

  • n: Run doas in non-interactive mode
  • e: The editor to use for this file.
  • u: The user doas will switch to, defaults to root. Must be in a format supported by doas.
  • h: Show usage page and exit.
  • C: No opt.
  • Cx: Disable doas configuration validation.

Note that options always override environment variables. If editor is set to empty via the command line this will cause the environment variable to be ignored.

Environment Variables

DOAS_EDITOR: The editor to use for this file.

Exit Status

If doas fails, doasedit will forward it's exit code. Refer to the OpenDoas Man Page for reasons why and specific meanings.

Features

  • A single doas invocation to edit and replace a file
    • Only ever one password prompt (no configuration required)
  • Choose your own editor and options (via the -eoption or the DOAS_EDITOR variable)
  • Sane editor detection Leveraging the VISUAL and EDITOR variables to set your editor
  • Restrict allowed editors via /etc/doasedit.conf
  • Configure editor sand boxing via /etc/doasedit.conf
  • Entire program contained in a single script file

Building

To build all you have to do is run make install with the proper privileges and make will take care of the rest, I've tried to follow the GNU Makefile conventions as much as I found it applicable, so you should be able to configure the build like other projects.