summaryrefslogtreecommitdiffstats
path: root/configuration/debian/tedge_agent
diff options
context:
space:
mode:
authorPradeepKiruvale <pradeepkumar.kj@softwareag.com>2022-04-21 15:03:09 +0530
committerGitHub <noreply@github.com>2022-04-21 15:03:09 +0530
commit001347fd92e0b697a01a591ae68b3316be0d9ec1 (patch)
tree9d3555a8588d9e2cd8640658374812dd359fa0a7 /configuration/debian/tedge_agent
parent7033ab55c70611bec47f2aee79e38de7e88e6d58 (diff)
Have a single unix user used for all the thin-edge daemons (#1085)
* Closes #1031 single tedge user Signed-off-by: Pradeep Kumar K J <pradeepkumar.kj@softwareag.com> * Add script to upgrade tedge from 0.6 Signed-off-by: Pradeep Kumar K J <pradeepkumar.kj@softwareag.com>
Diffstat (limited to 'configuration/debian/tedge_agent')
-rw-r--r--configuration/debian/tedge_agent/postinst22
-rw-r--r--configuration/debian/tedge_agent/postrm28
2 files changed, 3 insertions, 47 deletions
diff --git a/configuration/debian/tedge_agent/postinst b/configuration/debian/tedge_agent/postinst
index 7430e3dc..4059b182 100644
--- a/configuration/debian/tedge_agent/postinst
+++ b/configuration/debian/tedge_agent/postinst
@@ -2,26 +2,6 @@
set -e
-### Create a group "tedge-agent" if not created before
-if ! getent group tedge-agent >/dev/null; then
- addgroup --quiet --system tedge-agent
-fi
-
-### Create a user "tedge-agent" if not created before
-# Create user tedge-agent with no home(--no-create-home), no login(--shell) and in group tedge-agent(--ingroup)
-if ! getent passwd tedge-agent >/dev/null; then
- adduser --quiet --system --no-create-home --ingroup tedge-agent --shell /usr/sbin/nologin tedge-agent
- adduser tedge-agent tedge
-fi
-
-### Create file in /etc/sudoers.d directory
-# tedge-agent needs to execute some of its operations as a system user therefore it needs an entry in /etc/sudoers.
-echo "%tedge-agent ALL = (ALL) NOPASSWD: /etc/tedge/sm-plugins/[a-zA-Z0-9]*, /bin/sync, /sbin/init" >/etc/sudoers.d/tedge-agent
-
-if [ -f "/etc/sudoers.d/010_pi-nopasswd" ]; then
- echo "%tedge-agent ALL = (ALL) NOPASSWD: /etc/tedge/sm-plugins/[a-zA-Z0-9]*, /bin/sync, /sbin/init" >/etc/sudoers.d/tedge-agent-nopasswd
-fi
-
# Reenable the services only if systemctl is available
if command -v systemctl >/dev/null; then
### Enable the sm services if the device is connected to c8y cloud
@@ -33,6 +13,6 @@ if command -v systemctl >/dev/null; then
fi
# Initialize the agent
-runuser -u tedge-agent -- tedge_agent --init
+runuser -u tedge -- tedge_agent --init
#DEBHELPER#
diff --git a/configuration/debian/tedge_agent/postrm b/configuration/debian/tedge_agent/postrm
index 115688e2..9b4c4681 100644
--- a/configuration/debian/tedge_agent/postrm
+++ b/configuration/debian/tedge_agent/postrm
@@ -1,23 +1,6 @@
#!/bin/sh
set -e
-remove_tedge_agent_user() {
- if getent passwd tedge-agent >/dev/null; then
- pkill -u tedge-agent || true
- deluser --quiet --system tedge-agent
- fi
-}
-
-remove_sudoers_file() {
- if [ -f "/etc/sudoers.d/tedge-agent" ]; then
- rm /etc/sudoers.d/tedge-agent
- fi
-
- if [ -f "/etc/sudoers.d/tedge-agent-nopasswd" ]; then
- rm /etc/sudoers.d/tedge-agent-nopasswd
- fi
-}
-
purge_agent_directory() {
if [ -d "/etc/tedge/.agent" ]; then
rm -rf /etc/tedge/.agent
@@ -26,17 +9,10 @@ purge_agent_directory() {
case "$1" in
purge)
- remove_tedge_agent_user
- remove_sudoers_file
- purge_agent_directory
- ;;
-
- remove)
- remove_tedge_agent_user
- remove_sudoers_file
+ purge_agent_directory
;;
- upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)