File opendoas.spec of Package opendoas

#
# spec file for package opendoas
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%if ! %{defined _distconfdir}
%define _distconfdir %{_sysconfdir}
%else
%define use_usretc 1
%endif
Name:           opendoas
Version:        6.8.2
Release:        0
Summary:        Choose to run a program as another user
License:        BSD-2-Clause
URL:            https://github.com/Duncaen/OpenDoas
Source0:        https://github.com/Duncaen/OpenDoas/releases/download/v%{version}/%{name}-%{version}.tar.gz
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  make
BuildRequires:  pam-devel
BuildRequires:  sudo
Requires(pre):  permissions

%description
PLEASE BE AWARE THAT THIS PACKAGE HAS NOT BEEN AUDITED BY THE SUSE SECURITY TEAM!

Doas - "do" and "as".
A program originally written for OpenBSD which allows a user to run a command
as though they were another user. Typically doas is used to allow non-privleged
users to run commands as though they were the root user. The doas program acts
as an alternative to sudo, which is a popular method in the Linux community for
granting admin access to specific users.

It can be used as an alternative to sudo.

%prep
%setup -q

%build
OS=linux ./configure --prefix=/usr
%make_build

%install
mkdir %{buildroot}%{_sysconfdir}
cat << EOF > %{buildroot}%{_sysconfdir}/doas.conf
# see man doas.conf for details
# permit persist setenv { PKG_CACHE PKG_PATH } aja cmd pkg_add
# permit setenv { -ENV PS1=$DOAS_PS1 SSH_AUTH_SOCK } :wheel
# permit nopass tedu as root cmd /usr/sbin/procmap
# permit nopass keepenv setenv { PATH } root as root
EOF
mkdir -p %{buildroot}%{_distconfdir}/pam.d
cp /usr/lib/pam.d/sudo %{buildroot}%{_distconfdir}/pam.d/doas
sed -i '/chown ${BINOWN}/d' GNUmakefile
%make_install
%if %{defined use_usretc}
rm -r %{buildroot}%{_sysconfdir}/pam.d
%endif

%post
%set_permissions %{_bindir}/doas

%verifyscript
%verify_permissions -e %{_bindir}/doas

%files
%config %{_sysconfdir}/doas.conf
%{_distconfdir}/pam.d/doas
%{_bindir}/doas
%{_mandir}/man1/doas.1%{?ext_man}
%{_mandir}/man5/doas.conf.5%{?ext_man}

%changelog
openSUSE Build Service is sponsored by