1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00

F #2152: Improve SSH agent service unit (#4627)

- change /run/one to /var/run/one - /run/one is either bind-mount or
  symlink and can be changed while /var/run/one is configured via
  tmpfiles.d/opennebula*.conf - it is more consistent now
- add a dependency to SSH agent unit for remote-fs in the cases when
  /var/lib/one (oneadmin's home) is on a network filesystem
- add SSH agent support to opennebula-hem service

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>
This commit is contained in:
Petr Ospalý 2020-04-29 14:59:46 +02:00 committed by GitHub
parent 0d31351358
commit 59426dd8fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -7,6 +7,7 @@ After=opennebula.service
Type=simple
Group=oneadmin
User=oneadmin
EnvironmentFile=-/var/run/one/ssh-agent.env
ExecStartPre=-/usr/sbin/logrotate -f /etc/logrotate.d/opennebula-hem -s /var/lib/one/.logrotate.status
ExecStart=/usr/bin/ruby /usr/lib/one/onehem/onehem-server.rb
StartLimitInterval=60

View File

@ -1,16 +1,17 @@
[Unit]
Description=OpenNebula SSH agent
After=remote-fs.target
[Service]
Type=forking
Group=oneadmin
User=oneadmin
Environment=SSH_AUTH_SOCK=/run/one/ssh-agent.sock
Environment=SSH_AUTH_SOCK=/var/run/one/ssh-agent.sock
# ssh-agent is executed via shell wrapper to workaround a SELinux issue
ExecStartPre=/bin/sh -c "echo SSH_AUTH_SOCK=$SSH_AUTH_SOCK > /run/one/ssh-agent.env"
ExecStartPre=/bin/sh -c "echo SSH_AUTH_SOCK=$SSH_AUTH_SOCK > /var/run/one/ssh-agent.env"
ExecStart=/bin/sh -c "exec /usr/bin/ssh-agent -a $SSH_AUTH_SOCK"
ExecStartPost=/bin/sh -c "/usr/bin/ssh-add"
ExecStopPost=/usr/bin/rm -f /run/one/ssh-agent.env
ExecStartPost=-/bin/sh -c "/usr/bin/ssh-add"
ExecStopPost=/usr/bin/rm -f /var/run/one/ssh-agent.env
ExecReload=/bin/sh -c "/usr/bin/ssh-add -D && /usr/bin/ssh-add"
Restart=on-failure
# NOTE: ssh-agent returns "2" as the exit code on SIGTERM or on termination via:

View File

@ -10,7 +10,7 @@ Wants=opennebula-ssh-agent.service
Type=notify
Group=oneadmin
User=oneadmin
EnvironmentFile=-/run/one/ssh-agent.env
EnvironmentFile=-/var/run/one/ssh-agent.env
ExecStartPre=-/usr/sbin/logrotate -f /etc/logrotate.d/opennebula -s /var/lib/one/.logrotate.status
ExecStart=/usr/bin/oned -f
ExecStopPost=/usr/share/one/follower_cleanup