after pkg upgrade doas config gone?

Hi there, I have been using doas to "separate" my user from root, but after `pkg upgrade` from 15.1p5 to 15.1p6 the doas config was deleted??? Im sure I was using doas before :).

So is normal that this kind of files are deleted between upgrades or I missed something? like the file got moved to a newer place?

after copying from root again the sample config all is working again, so just wondering...


cp /usr/local/etc/containers/pf.conf.sample /etc/pf.conf
 
2 more points:
- pkg has nothing to do with doas or pf unless you opted for the experimental pkgbase
- that "/usr/local/etc/containers" path is definitely not coming from base; are we really talking about vanilla FreeBSD here?


edit: My brain was in OpenBSD mode - on FreeBSD 'doas' is of course a port (sadly)
 
FYI, doas package does not install doas.conf.sample any more:

I've stumbled upon this yesterday evening when configuring a new VM and wondered whether my memory started to fail me because I recall that wheel group membership used to be enough to run commands with doas(1) in the past.
Code:
op@base:~ % pkg info -a | grep doas
doas-6.4_1                     Simple sudo alternative to run commands as another user
 
What does pf.conf(5) have to do with doas(1)? Did you mix up the config files when posting?
a sorry, I think I missed a little my writing... I tried to do a doas command as I have executed lots of doas commands and not failed before because config was not there... and this time it was not there... so maybe I was copying pf just to check if I can use doas over a command.
 
Yes, it is removed unless it was edited.

so if I copy the sample doas it gets deleted on upgrade???

nice to know, is there any other file removed?? like pf.conf which I also referenced here?

or just doas.conf is deleted if not edited from sample?


By the way, what would be then a good doas file???
 
so if I copy the sample doas it gets deleted on upgrade???
No, it won't happen anymore, this was specific to this update of the port.

The port did not install it intentionally by default, but later, it got installed as sample, now we had reverted that process.
nice to know, is there any other file removed?? like pf.conf which I also referenced here?
No, it was specific to security/doas.
or just doas.conf is deleted if not edited from sample?
Yes, if it was never edited (i.e configured by system user), it will get deleted, like how we wanted.
By the way, what would be then a good doas file???
This is the default configuration:

Code:
# Sample file for doas
# Please see doas.conf manual page for information on setting
# up a doas.conf file.

# Permit members of the wheel group to perform actions as root.
permit :wheel

# Same without having to enter the password
permit nopass :wheel

# Permit user alice to run commands as a root user.
permit alice as root

# Permit user bob to run programs as root, maintaining
# environment variables. Useful for GUI applications.
permit keepenv bob as root

# Permit user cindy to run only the pkg package manager as root
# to perform package updates and upgrades.
permit cindy as root cmd pkg args update
permit cindy as root cmd pkg args upgrade

# Allow david to run id command as root without logging it
permit nolog david as root cmd id

A few of security risks:
1. It allows any user in the wheel group to become super-user without requiring any password.
2. If there was a user named alice, it would give them the root permission.
3. Continuation of 2nd with different goals for different usernames.

At least I would delete all but keep only permit :wheel. I am not used to the doas' configuration, though.

Martin Kalcok (from PR 300634) had reported that in our Bug Reports database and the maintainer of security/doas port (Jesse Smith) accepted that the configuration was never meant to be installed as sample.

I would recommend to read the PR 300634 as more detailed discussion happened there.
 
By the way, what would be then a good doas file???

as nxjoseph@ already wrote: in most cases a single rule permit :wheel is fine for most systems.

Personally on systems I want some tighter restrictions on, I explicitly create a group 'doas' and add only the users that I want to be able to become root. This way these users don't need to be members of :wheel, which might prevent accidents like malformed 'rm' commands from nuking a production system as they are normal users confined to their /home unless they explicitly become root via doas.
 
I explicitly create a group 'doas' and add only the users that I want to be able to become root. This way these users don't need to be members of :wheel
Noob Q, what would be the difference of addings users to `doas` group instead of directly to `wheel` if `doas` command let you act as root via de `permit :doas` config?
 
Wheel is defiantly a security problem. When I first started all users got it.
Then I realized it was defeated the purpose of even using users. Groups are very powerful.
Video and Audio you must tinker with it.
Sometimes it is not easy diagnosing 'user' based problems without running that process as root.
It could be easier.
As a new user easiest is elevated. Not best practices.

By the way, what would be then a good doas file???
There is no one sized fits all.

It is application based.
In my sample here I am using a desktop and networkmgr for its ease of wireless setup.
But my amended answer would be --this would have a DOAS group not WHEEL--
 
Back
Top