diff --git a/actors/linux/Makefile b/actors/linux/Makefile index 809db0eb..f071daa3 100644 --- a/actors/linux/Makefile +++ b/actors/linux/Makefile @@ -18,7 +18,15 @@ CACHES := $(shell find $(SOURCEDIR) -name '__pycache__') clean: rm -rf $(PYC) $(CACHES) $(DESTDIR) -install: +install-xrdp-udsactor: + mkdir -p $(BINDIR) + cp scripts/uds-sesman.sh $(BINDIR)/uds-sesman + cp scripts/uds-wait-session.sh $(BINDIR)/uds-wait-session + + chmod 0755 $(BINDIR)/uds-sesman + chmod 0755 $(BINDIR)/uds-wait-session + +install-udsactor: rm -rf $(DESTDIR) mkdir -p $(LIBDIR) mkdir -p $(BINDIR) diff --git a/actors/linux/debian/.gitignore b/actors/linux/debian/.gitignore index c1515660..ae3f4b8a 100644 --- a/actors/linux/debian/.gitignore +++ b/actors/linux/debian/.gitignore @@ -1 +1,2 @@ /udsactor/ +/udsactor-xrdp/ diff --git a/actors/linux/debian/control b/actors/linux/debian/control index ae14fe30..25dbb027 100644 --- a/actors/linux/debian/control +++ b/actors/linux/debian/control @@ -13,5 +13,11 @@ Architecture: all Depends: policykit-1(>=0.100), python-requests (>=0.8.2), python-qt4 (>=4.9), python-six(>=1.1), python-prctl(>=1.1.1), python (>=2.7), ${misc:Depends} Description: Actor for Universal Desktop Services (UDS) Broker This package provides the required components to allow this machine to work on an environment managed by UDS Broker. - . +Package: udsactor-xrdp +Section: x11 +Priority: optional +Architecture: all +Depends: xrdp (>= 0.6.0), udsactor (>= ${Source-Version}), libpam-modules-bin (>=1.0), ${misc:Depends} +Description: UDS Actor component for xrdp + This package provides connection between uds actor and xrdp, so session can be managed diff --git a/actors/linux/debian/files b/actors/linux/debian/files index 3ec59737..61f08fad 100644 --- a/actors/linux/debian/files +++ b/actors/linux/debian/files @@ -1 +1,2 @@ udsactor_1.7.0_all.deb admin optional +udsactor-xrdp_1.7.0_all.deb x11 optional diff --git a/actors/linux/debian/rules b/actors/linux/debian/rules index cacfb707..e6d90a06 100755 --- a/actors/linux/debian/rules +++ b/actors/linux/debian/rules @@ -21,7 +21,8 @@ install: build dh_testroot dh_prep dh_installdirs - $(MAKE) DESTDIR=$(CURDIR)/debian/udsactor install + $(MAKE) DESTDIR=$(CURDIR)/debian/udsactor install-udsactor + $(MAKE) DESTDIR=$(CURDIR)/debian/udsactor-xrdp install-xrdp-udsactor binary-arch: build install # emptyness binary-indep: build install diff --git a/actors/linux/debian/config b/actors/linux/debian/udsactor.config similarity index 100% rename from actors/linux/debian/config rename to actors/linux/debian/udsactor.config diff --git a/actors/linux/debian/init b/actors/linux/debian/udsactor.init similarity index 100% rename from actors/linux/debian/init rename to actors/linux/debian/udsactor.init diff --git a/actors/linux/debian/links b/actors/linux/debian/udsactor.links similarity index 100% rename from actors/linux/debian/links rename to actors/linux/debian/udsactor.links diff --git a/actors/linux/debian/postinst b/actors/linux/debian/udsactor.postinst similarity index 100% rename from actors/linux/debian/postinst rename to actors/linux/debian/udsactor.postinst diff --git a/actors/linux/debian/postrm b/actors/linux/debian/udsactor.postrm similarity index 100% rename from actors/linux/debian/postrm rename to actors/linux/debian/udsactor.postrm diff --git a/actors/linux/debian/prerm b/actors/linux/debian/udsactor.prerm similarity index 100% rename from actors/linux/debian/prerm rename to actors/linux/debian/udsactor.prerm diff --git a/actors/linux/debian/templates b/actors/linux/debian/udsactor.templates similarity index 100% rename from actors/linux/debian/templates rename to actors/linux/debian/udsactor.templates diff --git a/actors/linux/scripts/uds-sesman.sh b/actors/linux/scripts/uds-sesman.sh new file mode 100755 index 00000000..bb8de2e7 --- /dev/null +++ b/actors/linux/scripts/uds-sesman.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +env > /tmp/env.txt + +if [ "$PAM_TYPE" = "open_session" ]; then + nohup /usr/bin/udsactor login $PAM_USER & + # Wait in backgroud to TTY to close (close_session is not being invoked right now) + nohup /usr/bin/uds-wait-session & +elif [ "$PAM_TYPE" = "close_session" ]; then + nohup /usr/bin/udsactor logout $PAM_USER & +fi + +return 0 diff --git a/actors/linux/scripts/uds-wait-session.sh b/actors/linux/scripts/uds-wait-session.sh new file mode 100755 index 00000000..93839e17 --- /dev/null +++ b/actors/linux/scripts/uds-wait-session.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +while : +do + sleep 5 # Wait 5 seconds between checks + found=`ps -f -u$PAM_USER | grep -v grep | grep -v uds-wait-session | grep "$PAM_TTY" | wc -l` + + if [ "$found" = "0" ]; then + /usr/bin/udsactor logout $PAM_USER + exit 0 + fi +done