Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:system:userspace:open_doas [2023/02/20 22:08] i3_relativism |
en:system:userspace:open_doas [2025/04/21 02:01] (current) throgh [Usage] |
||
---|---|---|---|
Line 12: | Line 12: | ||
===== Installation ===== | ===== Installation ===== | ||
- | To install [[https:// | + | To install [[https:// |
<code bash> | <code bash> | ||
- | pacman -S doas | + | pacman -S opendoas |
</ | </ | ||
- | <note important> | + | <note important> |
===== Usage ===== | ===== Usage ===== | ||
Line 29: | Line 29: | ||
<code bash> | <code bash> | ||
- | $ doas '' | + | $ doas COMMAND |
</ | </ | ||
Line 61: | Line 61: | ||
The configuration file must end with a newline | The configuration file must end with a newline | ||
</ | </ | ||
+ | |||
+ | For example, to allow members of the <color # | ||
+ | |||
+ | Edit <color # | ||
+ | |||
+ | <code bash> | ||
+ | permit nopass :libre as root cmd / | ||
+ | </ | ||
==== Basic setup ==== | ==== Basic setup ==== | ||
Line 76: | Line 84: | ||
</ | </ | ||
+ | <note tip> | ||
To check <color # | To check <color # | ||
Line 81: | Line 90: | ||
# doas -C / | # doas -C / | ||
</ | </ | ||
+ | </ | ||
<note important> | <note important> | ||
It is imperative that <color # | It is imperative that <color # | ||
</ | </ | ||
- | |||
- | To allow members of the <color # | ||
- | |||
- | Edit <color # | ||
- | |||
- | <code bash> | ||
- | permit nopass :libre as root cmd / | ||
- | </ | ||
- | |||
- | WIP?? | ||
- | what is smartctl is this systemd related? | ||
- | endWIP??! | ||
==== Rulesets ==== | ==== Rulesets ==== | ||
The [[|doas]] tool allows the creation of rules which only apply to certain commands. | The [[|doas]] tool allows the creation of rules which only apply to certain commands. | ||
- | A rule can be specified to allow a certain user to use a command only available to //root// | + | A rule can be specified to allow a certain user to use a command only available to //root//. |
In <color # | In <color # | ||
Line 159: | Line 157: | ||
Adding the **<color # | Adding the **<color # | ||
- | By adding the **<color # | + | By adding the **<color # |
<code bash> | <code bash> | ||
Line 171: | Line 169: | ||
</ | </ | ||
- | If you have multiple shell logins to a machine, each login will require authentication. Additionally, | + | If you have multiple shell logins to a machine, each login will require authentication. Additionally, |
<code bash> | <code bash> | ||
Line 188: | Line 186: | ||
There are two config keywords related to environment, | There are two config keywords related to environment, | ||
- | Using **<color # | + | Using **<color # |
<code bash> | <code bash> | ||
Line 200: | Line 198: | ||
Each rule in <color # | Each rule in <color # | ||
- | In most situations, <color # | + | In most situations, <color # |
<code bash> | <code bash> | ||
Line 210: | Line 208: | ||
=== Commands === | === Commands === | ||
- | We’re nearing the end of our tour of the <color # | + | We’re nearing the end of our tour of the <color # |
<code bash> | <code bash> | ||
- | permit nopass :operator | + | permit nopass :libre cmd reboot |
</ | </ | ||
- | Normally, reboot requires //root// privileges. It is instead executed indirectly by the setuid program **shutdown**, | + | Normally, reboot requires //root// privileges. It is instead executed indirectly by the setuid program **shutdown**, |
<code bash> | <code bash> | ||
Line 226: | Line 224: | ||
In both of these examples, the **cmd** was specified with only the base name. In these cases, <color # | In both of these examples, the **cmd** was specified with only the base name. In these cases, <color # | ||
- | Any command arguments specified must be specified in their entirety. | + | Any command arguments specified must be specified in their entirety: |
<code bash> | <code bash> | ||
Line 235: | Line 233: | ||
These two rules will allow //alice// to turn the wifi interface on and off, but not change any of its other parameters. | These two rules will allow //alice// to turn the wifi interface on and off, but not change any of its other parameters. | ||
- | Some userland utilities that gather information from the kernel only present a restricted subset of information when as regular users. To see the full information requires running as //root//. For example, **fstat** will only print minimal information about unix domain sockets. | + | Some userland utilities that gather information from the kernel only present a restricted subset of information when as regular users. To see the full information requires running as //root//. For example, **fstat** will only print minimal information about unix domain sockets: |
<code bash> | <code bash> | ||
Line 245: | Line 243: | ||
</ | </ | ||
- | But when run again as //root//, we see much more information. | + | But when run again as //root//, we see much more information: |
<code bash> | <code bash> | ||
Line 256: | Line 254: | ||
<note tip> | <note tip> | ||
- | This allows us to match these sockets up with the process on the other end. | + | This allows us to match these sockets up with the process on the other end: |
<code bash> | <code bash> | ||
Line 265: | Line 263: | ||
</ | </ | ||
- | These kernel addresses are normally hidden because they reveal information about the kernel’s memory layout which can be used to facilitate exploits, but if we trust // | + | These kernel addresses are normally hidden because they reveal information about the kernel’s memory layout which can be used to facilitate exploits, but if we trust // |
<code bash> | <code bash> | ||
Line 275: | Line 273: | ||
=== deny === | === deny === | ||
- | In contrast to all the **<color # | + | In contrast to all the **<color # |
<code bash> | <code bash> | ||
Line 288: | Line 286: | ||
The **doas** command itself has a few options. | The **doas** command itself has a few options. | ||
- | Since we just finished looking at the config file syntax, the <color # | + | Since we just finished looking at the config file syntax, the <color # |
<code bash> | <code bash> | ||
Line 298: | Line 296: | ||
When writing possibly noninteractive scripts that incorporate **doas**, the <color # | When writing possibly noninteractive scripts that incorporate **doas**, the <color # | ||
- | thanks | ||
==== Authentication ==== | ==== Authentication ==== | ||
+ | === Nopass feature === | ||
- | The **<color # | + | The **<color # |
Edit <color # | Edit <color # | ||
Line 310: | Line 308: | ||
</ | </ | ||
- | <note warning> | + | === Persist |
- | Due to OpenBSD-specific kernel API required by **doas** to set and clear timeouts, the **<color # | + | |
- | </ | + | |
- | With the **<color #816E00/#FAE65B> | + | **doas** provides the <color #620BB9/#EEDDFF> |
- | Edit <color # | + | Edit <color # |
<code bash> | <code bash> | ||
Line 322: | Line 318: | ||
</ | </ | ||
+ | <note warning> | ||
+ | Due to OpenBSD-specific kernel API required by **doas** to set and clear timeouts, the **<color # | ||
+ | </ | ||
==== Testing ==== | ==== Testing ==== | ||
Line 350: | Line 349: | ||
The **doas** can not only be used to perform actions with //root// privileges, it also allows to target certain users and groups. The syntax to distinguish between groups (like //wheel//) and users (like //larry//) is a leading colon. | The **doas** can not only be used to perform actions with //root// privileges, it also allows to target certain users and groups. The syntax to distinguish between groups (like //wheel//) and users (like //larry//) is a leading colon. | ||
- | Edit <color # | + | Edit <color # |
<code bash> | <code bash> | ||
Line 358: | Line 357: | ||
By adding this rule, the user //larry// is allowed to perform actions as the // | By adding this rule, the user //larry// is allowed to perform actions as the // | ||
- | ==== Bash tab completion ==== | + | ===== Bash tab completion |
- | By default Bash will only tab complete files and directories within the current or referenced directory. To tell Bash to complete arguments as if they were separate commands (also leveraging the tab completion settings of other commands) the following can be added to either the users WIP.bashrc, or the global / | + | By default Bash will only tab complete files and directories within the current or referenced directory. To tell Bash to complete arguments as if they were separate commands (also leveraging the tab completion settings of other commands) the following can be added to either the users .bashrc, or the global / |
<code bash> | <code bash> | ||
Line 366: | Line 365: | ||
</ | </ | ||
- | ===== Tips and tricks ===== | ||
- | |||
- | ==== doas persist feature ==== | ||
- | |||
- | '' | ||
- | |||
- | <code bash> | ||
- | permit persist :wheel | ||
- | </ | ||
- | |||
- | < | ||
- | The **<color # | ||
- | </ | ||
- | ==== Smooth transition sudo to doas ==== | + | ===== Smooth transition sudo to doas ===== |
For a smooth transition from '' | For a smooth transition from '' | ||
Line 406: | Line 392: | ||
</ | </ | ||
- | ==== See also ==== | + | ===== See also ===== |
* See also [[en: | * See also [[en: | ||
Line 414: | Line 400: | ||
==== External resources ==== | ==== External resources ==== | ||
- | WIP | ||
"It would not have been possible to finish doas without the support of many other OpenBSD developers and users. In particular, Vadim Zhukov contributed immensely to the config parser and regress testsuite; Todd Miller, Damien Miller, and Martijn van Duren provided ideas and inspiration; | "It would not have been possible to finish doas without the support of many other OpenBSD developers and users. In particular, Vadim Zhukov contributed immensely to the config parser and regress testsuite; Todd Miller, Damien Miller, and Martijn van Duren provided ideas and inspiration; |