Quantcast

Systemd User config missing in 3.5.26

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Systemd User config missing in 3.5.26

Adam Retter
In version 3.5.26 of the Wrapper, I have configured the lines:

RUN_AS_USER=my-user
USE_SYSTEMD=true

in the shell file, however when installing the wrapper the generated
systemd config file is missing the user property.
The resultant systemd config /etc/systemd/system/my-service.service:

[Unit]
Description=My Service
After=syslog.target

[Service]
Type=forking
ExecStart=/usr/local/my-app/tools/wrapper/bin/my-app.sh start sysd
ExecStop=/usr/local/my-app/tools/wrapper/bin/my-app.sh stop sysd

[Install]
WantedBy=multi-user.target


However systemd won't correctly start and stop the service because it
attempts to use the wrong user. To fix this I have to manually modify
/etc/systemd/system/my-service.service after installation and add the
following to the `[Service]` section:

User=my-user


Thus looks like a bug in the installation of the service wrapper to
me, can anyone confirm?
I have tried this on both Ubuntu Vivid and Ubuntu Wily.

--
Adam Retter

eXist Developer
{ United Kingdom }
[hidden email]
irc://irc.freenode.net/existdb

------------------------------------------------------------------------------
_______________________________________________
Wrapper-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wrapper-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Systemd User config missing in 3.5.26

Alexandre Klein
Adam,

Thank you for letting us know about this issue.

You are correct, when creating the systemd service file, we don't check if RUN_AS_USER is set.Thus the service is always run as root.

We will fix this in our next release (3.5.28).

In the meantime, in case you need this to be fixed asap, you can modify the script file.
Go to the function systemdInstall() and add these lines after "echo "ExecStop=....":

if [ "X${RUN_AS_USER}" != "X" ] ; then
  echo "User=${RUN_AS_USER"}    >> "${SYSTEMD_SERVICE_FILE}"
fi

Please let me know if you have any other questions.

Regards,
Alexandre Klein


Alexandre Klein
Tanuki Software, Ltd.
6-18-10-4F Nishi-Kasai, Edogawa-ku
Tokyo 134-0088 Japan

On Mon, Oct 5, 2015 at 8:43 PM, Adam Retter <[hidden email]> wrote:
In version 3.5.26 of the Wrapper, I have configured the lines:

RUN_AS_USER=my-user
USE_SYSTEMD=true

in the shell file, however when installing the wrapper the generated
systemd config file is missing the user property.
The resultant systemd config /etc/systemd/system/my-service.service:

[Unit]
Description=My Service
After=syslog.target

[Service]
Type=forking
ExecStart=/usr/local/my-app/tools/wrapper/bin/my-app.sh start sysd
ExecStop=/usr/local/my-app/tools/wrapper/bin/my-app.sh stop sysd

[Install]
WantedBy=multi-user.target


However systemd won't correctly start and stop the service because it
attempts to use the wrong user. To fix this I have to manually modify
/etc/systemd/system/my-service.service after installation and add the
following to the `[Service]` section:

User=my-user


Thus looks like a bug in the installation of the service wrapper to
me, can anyone confirm?
I have tried this on both Ubuntu Vivid and Ubuntu Wily.

--
Adam Retter

eXist Developer
{ United Kingdom }
[hidden email]
irc://irc.freenode.net/existdb

------------------------------------------------------------------------------
_______________________________________________
Wrapper-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wrapper-user


------------------------------------------------------------------------------

_______________________________________________
Wrapper-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wrapper-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Systemd User config missing in 3.5.26

Alexandre Klein
Sorry I did a small typo:
echo "User=${RUN_AS_USER"}    >> "${SYSTEMD_SERVICE_FILE}"
should be:
echo "User=${RUN_AS_USER}"    >> "${SYSTEMD_SERVICE_FILE}"

Regards,
Alexandre Klein

Alexandre Klein
Tanuki Software, Ltd.
6-18-10-4F Nishi-Kasai, Edogawa-ku
Tokyo 134-0088 Japan

On Thu, Oct 22, 2015 at 2:27 PM, Alexandre Klein <[hidden email]> wrote:
Adam,

Thank you for letting us know about this issue.

You are correct, when creating the systemd service file, we don't check if RUN_AS_USER is set.Thus the service is always run as root.

We will fix this in our next release (3.5.28).

In the meantime, in case you need this to be fixed asap, you can modify the script file.
Go to the function systemdInstall() and add these lines after "echo "ExecStop=....":

if [ "X${RUN_AS_USER}" != "X" ] ; then
  echo "User=${RUN_AS_USER"}    >> "${SYSTEMD_SERVICE_FILE}"
fi

Please let me know if you have any other questions.

Regards,
Alexandre Klein


Alexandre Klein
Tanuki Software, Ltd.
6-18-10-4F Nishi-Kasai, Edogawa-ku
Tokyo 134-0088 Japan

On Mon, Oct 5, 2015 at 8:43 PM, Adam Retter <[hidden email]> wrote:
In version 3.5.26 of the Wrapper, I have configured the lines:

RUN_AS_USER=my-user
USE_SYSTEMD=true

in the shell file, however when installing the wrapper the generated
systemd config file is missing the user property.
The resultant systemd config /etc/systemd/system/my-service.service:

[Unit]
Description=My Service
After=syslog.target

[Service]
Type=forking
ExecStart=/usr/local/my-app/tools/wrapper/bin/my-app.sh start sysd
ExecStop=/usr/local/my-app/tools/wrapper/bin/my-app.sh stop sysd

[Install]
WantedBy=multi-user.target


However systemd won't correctly start and stop the service because it
attempts to use the wrong user. To fix this I have to manually modify
/etc/systemd/system/my-service.service after installation and add the
following to the `[Service]` section:

User=my-user


Thus looks like a bug in the installation of the service wrapper to
me, can anyone confirm?
I have tried this on both Ubuntu Vivid and Ubuntu Wily.

--
Adam Retter

eXist Developer
{ United Kingdom }
[hidden email]
irc://irc.freenode.net/existdb

------------------------------------------------------------------------------
_______________________________________________
Wrapper-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wrapper-user



------------------------------------------------------------------------------

_______________________________________________
Wrapper-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wrapper-user
Loading...