commit:     31af51e4bf339fb907f84dc80695dde8b5dcba1a
Author:     Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
AuthorDate: Sun May 14 02:31:21 2023 +0000
Commit:     Anna Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
CommitDate: Sun May 14 02:31:21 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=31af51e4

net-im/mastoposter: don't run as root

Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq.in>

 net-im/mastoposter/files/mastoposter.initd                           | 5 +++++
 net-im/mastoposter/files/mastoposter.service                         | 2 ++
 .../{mastoposter-0.1.ebuild => mastoposter-0.1-r1.ebuild}            | 3 ++-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/net-im/mastoposter/files/mastoposter.initd 
b/net-im/mastoposter/files/mastoposter.initd
index 0057cddc4..6e3621287 100644
--- a/net-im/mastoposter/files/mastoposter.initd
+++ b/net-im/mastoposter/files/mastoposter.initd
@@ -6,6 +6,7 @@
 
 command="/usr/bin/mastoposter"
 command_args="${MASTOPOSTER_CONFIG_FILE:=/etc/mastoposter/config.ini}"
+command_user="mastoposter:mastoposter"
 command_background=1
 pidfile="/run/${RC_SVCNAME}.pid"
 output_log="/var/log/${RC_SVCNAME}.log"
@@ -14,3 +15,7 @@ error_log="${output_log}"
 depend() {
        need net
 }
+
+start_pre() {
+       checkpath -fo "${command_user}" "${output_log}"
+}

diff --git a/net-im/mastoposter/files/mastoposter.service 
b/net-im/mastoposter/files/mastoposter.service
index 095626e7b..89401ca32 100644
--- a/net-im/mastoposter/files/mastoposter.service
+++ b/net-im/mastoposter/files/mastoposter.service
@@ -5,6 +5,8 @@ Wants=network-online.target
 
 [Service]
 Type=simple
+User=mastoposter
+Group=mastoposter
 ExecStart=/usr/bin/mastoposter /etc/mastoposter/config.ini
 Restart=always
 RestartSec=5

diff --git a/net-im/mastoposter/mastoposter-0.1.ebuild 
b/net-im/mastoposter/mastoposter-0.1-r1.ebuild
similarity index 92%
rename from net-im/mastoposter/mastoposter-0.1.ebuild
rename to net-im/mastoposter/mastoposter-0.1-r1.ebuild
index c490eae74..0544f4130 100644
--- a/net-im/mastoposter/mastoposter-0.1.ebuild
+++ b/net-im/mastoposter/mastoposter-0.1-r1.ebuild
@@ -18,6 +18,7 @@ SLOT="0"
 KEYWORDS="~amd64"
 
 RDEPEND="
+       acct-user/mastoposter
        dev-python/beautifulsoup4[${PYTHON_USEDEP}]
        dev-python/emoji[${PYTHON_USEDEP}]
        dev-python/httpx[${PYTHON_USEDEP}]
@@ -33,6 +34,6 @@ src_install() {
        newconfd "${FILESDIR}"/mastoposter.confd mastoposter
 
        insinto /etc/mastoposter
-       insopts --mode 600
+       insopts --mode=600 --owner=${PN} --group=${PN}
        doins config.ini
 }

Reply via email to