Re: guacd not starting on boot

2019-03-10 Thread Robert Dinse



 Ok, rebuilt with the correct --with-systemd-dir=/lib/systemd/system and
now I had more problems.  Launched out of init.d it ran as root, launced out
of systemd, the unit file it created has User=daemon so it runs as daemon.
Problem with that is only root has access to /var/run and to the encryption key
file so I changed it back to root despite that being less secure.

 Lastly it still failed because it tried to start before /misc was mounted
which is where the key file was so I modified the unit file line:

After=network.target

   to:

After=network.target misc.mount

/misc is the file system where I have the encryption certs and keys.

Now it starts properly after a reboot.  Downside, as with when it ran
out of /etc/init.d, it is running as root which from a security perspective
is undesirable.

What guacd should have is an item that goes into guacd.conf for user and
group so it can start as root, write the pid file and read the necessary
cert and key files, and then switch to said user and group just like Apache
httpd and tomcat do.

Then it could be both secure and functional.

-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
 Eskimo North Linux Friendly Internet Access, Shell Accounts, and Hosting.
   Knowledgeable human assistance, not telephone trees or script readers.
 See our web site: http://www.eskimo.com/ (206) 812-0051 or (800) 246-6874.

On Sun, 10 Mar 2019, Nick Couchman wrote:


Date: Sun, 10 Mar 2019 21:09:14 -0400
From: Nick Couchman 
Reply-To: user@guacamole.apache.org
To: user@guacamole.apache.org
Subject: Re: guacd not starting on boot

On Sun, Mar 10, 2019 at 8:07 PM Robert Dinse  wrote:



  I have guacd installed, built with the --with-systemd flag and it
does
not install a systemd file but an initd file which systemd recognizes and
says it installs however, while systemctl start guacd works fine and
systemctl enable guacd indicates it did the right thing, it does not start
upon boot, I have to manually start it.  Because some of the things it uses
are on NFS partitions, I suspect it's trying to start before NFS is up and
failing.



A couple of notes:
- The "--with-systemd" flag is not valid.  The flag is
"--with-systemd-dir=", where directory is the location where
you'd like the systemd files installed.  Can you please verify if that's
the flag you're using, and if you're specifying a directory, like
/etc/systemd/system or /usr/lib/systemd/system?
- Have you tried removing the initd file, reloading systemd (systemctl
daemon-reload) and seeing if the systemd unit then references the unit file
(assuming it's actually being installed)?
- If you have guacd running in a situation where NFS is required for guacd
to start you're going to have to make some modifications to either the
initd script or the systemd script.  It sounds like, in this case, that the
issue is not with either the guacd initd or systemd files, but with a
customized environment you have.  That's fine - we certainly don't expect
every environment to follow the ones we're used to; however, you may have
to do a little tweaking to the scripts to make them wait for NFS to be up
before starting guacd, if guacd is on a NFS share.  I would suspect even if
you get the systemd script to install that you'll still have the same
issue, because the standard systemd unit file we provide does not require
NFS to be up.  Fortunately, those changes should be relatively trivial to
either the initd script or the systemd unit file.

-Nick



Re: guacd not starting on boot

2019-03-10 Thread Nick Couchman
On Sun, Mar 10, 2019 at 8:07 PM Robert Dinse  wrote:

>
>   I have guacd installed, built with the --with-systemd flag and it
> does
> not install a systemd file but an initd file which systemd recognizes and
> says it installs however, while systemctl start guacd works fine and
> systemctl enable guacd indicates it did the right thing, it does not start
> upon boot, I have to manually start it.  Because some of the things it uses
> are on NFS partitions, I suspect it's trying to start before NFS is up and
> failing.
>
>
A couple of notes:
- The "--with-systemd" flag is not valid.  The flag is
"--with-systemd-dir=", where directory is the location where
you'd like the systemd files installed.  Can you please verify if that's
the flag you're using, and if you're specifying a directory, like
/etc/systemd/system or /usr/lib/systemd/system?
- Have you tried removing the initd file, reloading systemd (systemctl
daemon-reload) and seeing if the systemd unit then references the unit file
(assuming it's actually being installed)?
- If you have guacd running in a situation where NFS is required for guacd
to start you're going to have to make some modifications to either the
initd script or the systemd script.  It sounds like, in this case, that the
issue is not with either the guacd initd or systemd files, but with a
customized environment you have.  That's fine - we certainly don't expect
every environment to follow the ones we're used to; however, you may have
to do a little tweaking to the scripts to make them wait for NFS to be up
before starting guacd, if guacd is on a NFS share.  I would suspect even if
you get the systemd script to install that you'll still have the same
issue, because the standard systemd unit file we provide does not require
NFS to be up.  Fortunately, those changes should be relatively trivial to
either the initd script or the systemd unit file.

-Nick


Re: guacd not starting on boot

2019-03-10 Thread Mike Jumper
You don't need a threaded reader - just choose the most relevant message
and reply to that, as you would with any email conversation.

- Mike

On Sun, Mar 10, 2019, 17:39 Robert Dinse  wrote:

>
>   Sorry I am not precisely good at remembering what I put in the
> starting
> line.  You might use a threaded mail reader, not everyone, including
> myself,
> does.
>
>
> -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
>   Eskimo North Linux Friendly Internet Access, Shell Accounts, and Hosting.
> Knowledgeable human assistance, not telephone trees or script readers.
>   See our web site: http://www.eskimo.com/ (206) 812-0051 or (800)
> 246-6874.
>
> On Sun, 10 Mar 2019, Mike Jumper wrote:
>
> > Date: Sun, 10 Mar 2019 17:36:34 -0700
> > From: Mike Jumper 
> > Reply-To: user@guacamole.apache.org
> > To: user@guacamole.apache.org
> > Subject: Re: guacd not starting on boot
> >
> > Robert, please stop recreating your threads with new subject lines. It
> > splits the conversation unnecessarily when the topic is not changing.
> >
> > For anyone encountering this thread, please see the original thread
> titled
> > "guacd startup":
> >
> >
> https://lists.apache.org/thread.html/0fec8a9906c86318b4de4356174c67492aa61aad3dc4a743fe87e9ee@%3Cuser.guacamole.apache.org%3E
> >
> > - Mike
> >
> >
> > On Sun, Mar 10, 2019 at 5:07 PM Robert Dinse  wrote:
> >
> >>
> >>   I have guacd installed, built with the --with-systemd flag and it
> >> does
> >> not install a systemd file but an initd file which systemd recognizes
> and
> >> says it installs however, while systemctl start guacd works fine and
> >> systemctl enable guacd indicates it did the right thing, it does not
> start
> >> upon boot, I have to manually start it.  Because some of the things it
> uses
> >> are on NFS partitions, I suspect it's trying to start before NFS is up
> and
> >> failing.
> >>
> >>
> >>
> -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
> >>   Eskimo North Linux Friendly Internet Access, Shell Accounts, and
> Hosting.
> >> Knowledgeable human assistance, not telephone trees or script
> readers.
> >>   See our web site: http://www.eskimo.com/ (206) 812-0051 or (800)
> >> 246-6874.
> >>
> >
>


Re: guacd not starting on boot

2019-03-10 Thread Robert Dinse



 Sorry I am not precisely good at remembering what I put in the starting
line.  You might use a threaded mail reader, not everyone, including myself,
does.

-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
 Eskimo North Linux Friendly Internet Access, Shell Accounts, and Hosting.
   Knowledgeable human assistance, not telephone trees or script readers.
 See our web site: http://www.eskimo.com/ (206) 812-0051 or (800) 246-6874.

On Sun, 10 Mar 2019, Mike Jumper wrote:


Date: Sun, 10 Mar 2019 17:36:34 -0700
From: Mike Jumper 
Reply-To: user@guacamole.apache.org
To: user@guacamole.apache.org
Subject: Re: guacd not starting on boot

Robert, please stop recreating your threads with new subject lines. It
splits the conversation unnecessarily when the topic is not changing.

For anyone encountering this thread, please see the original thread titled
"guacd startup":

https://lists.apache.org/thread.html/0fec8a9906c86318b4de4356174c67492aa61aad3dc4a743fe87e9ee@%3Cuser.guacamole.apache.org%3E

- Mike


On Sun, Mar 10, 2019 at 5:07 PM Robert Dinse  wrote:



  I have guacd installed, built with the --with-systemd flag and it
does
not install a systemd file but an initd file which systemd recognizes and
says it installs however, while systemctl start guacd works fine and
systemctl enable guacd indicates it did the right thing, it does not start
upon boot, I have to manually start it.  Because some of the things it uses
are on NFS partitions, I suspect it's trying to start before NFS is up and
failing.


-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
  Eskimo North Linux Friendly Internet Access, Shell Accounts, and Hosting.
Knowledgeable human assistance, not telephone trees or script readers.
  See our web site: http://www.eskimo.com/ (206) 812-0051 or (800)
246-6874.





Re: guacd not starting on boot

2019-03-10 Thread Mike Jumper
Robert, please stop recreating your threads with new subject lines. It
splits the conversation unnecessarily when the topic is not changing.

For anyone encountering this thread, please see the original thread titled
"guacd startup":

https://lists.apache.org/thread.html/0fec8a9906c86318b4de4356174c67492aa61aad3dc4a743fe87e9ee@%3Cuser.guacamole.apache.org%3E

- Mike


On Sun, Mar 10, 2019 at 5:07 PM Robert Dinse  wrote:

>
>   I have guacd installed, built with the --with-systemd flag and it
> does
> not install a systemd file but an initd file which systemd recognizes and
> says it installs however, while systemctl start guacd works fine and
> systemctl enable guacd indicates it did the right thing, it does not start
> upon boot, I have to manually start it.  Because some of the things it uses
> are on NFS partitions, I suspect it's trying to start before NFS is up and
> failing.
>
>
> -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
>   Eskimo North Linux Friendly Internet Access, Shell Accounts, and Hosting.
> Knowledgeable human assistance, not telephone trees or script readers.
>   See our web site: http://www.eskimo.com/ (206) 812-0051 or (800)
> 246-6874.
>


guacd not starting on boot

2019-03-10 Thread Robert Dinse



 I have guacd installed, built with the --with-systemd flag and it does
not install a systemd file but an initd file which systemd recognizes and
says it installs however, while systemctl start guacd works fine and
systemctl enable guacd indicates it did the right thing, it does not start
upon boot, I have to manually start it.  Because some of the things it uses
are on NFS partitions, I suspect it's trying to start before NFS is up and
failing.

-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
 Eskimo North Linux Friendly Internet Access, Shell Accounts, and Hosting.
   Knowledgeable human assistance, not telephone trees or script readers.
 See our web site: http://www.eskimo.com/ (206) 812-0051 or (800) 246-6874.


Re: guacd startup

2019-03-10 Thread Robert Dinse


 I gave it --with-systemd but when I enable it I still get:

systemctl enable guacd
guacd.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable guacd

 And systemctl status guacd still shows:

● guacd.service - LSB: Guacamole proxy daemon
   Loaded: loaded (/etc/init.d/guacd; generated)
   Active: active (running) since Sun 2019-03-10 00:00:05 PST; 35min ago
 Docs: man:systemd-sysv-generator(8)
Tasks: 1 (limit: 4915)
   Memory: 10.6M
   CGroup: /system.slice/guacd.service
   └─18489 /usr/local/sbin/guacd -p /var/run/guacd.pid

-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
 Eskimo North Linux Friendly Internet Access, Shell Accounts, and Hosting.
   Knowledgeable human assistance, not telephone trees or script readers.
 See our web site: http://www.eskimo.com/ (206) 812-0051 or (800) 246-6874.

On Sun, 10 Mar 2019, Lev Dubinets wrote:


Date: Sun, 10 Mar 2019 08:32:56 +
From: Lev Dubinets 
Reply-To: user@guacamole.apache.org
To: "user@guacamole.apache.org" 
Subject: Re: guacd startup

This looks like an init.d script, not a systemd unit. My understanding was that 
the --with-systemd flag should make guacd install an actual systemd unit.


From: Robert Dinse 
Sent: Saturday, March 9, 2019 11:51 PM
To: user@guacamole.apache.org
Subject: Re: guacd startup


#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   
https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apache.org%2Flicenses%2FLICENSE-2.0data=02%7C01%7C%7C3a304263f1074fa9068508d6a52d33d7%7C84df9e7fe9f640afb435%7C1%7C0%7C636878010886914636sdata=QeKTklfBVkQIdh1f7vCIXPOirRI0sjQZL1TY4iBC%2FJc%3Dreserved=0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

# guacd
#
# chkconfig:   2345 20 80
# description: Guacamole proxy daemon

### BEGIN INIT INFO
# Provides:  guacd
# Required-Start:$network $syslog
# Required-Stop: $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop:  0 1 6
# Short-Description: Guacamole proxy daemon
# Description: The Guacamole proxy daemon, required to translate remote desktop
protocols into the text-based Guacamole protocol used by the JavaScript
application.
### END INIT INFO

prog="guacd"
exec="/usr/local/sbin/$prog"
pidfile="/var/run/$prog.pid"

# Returns PID of currently running process, if any
getpid() {

if [ -f "$pidfile" ]
then

read PID < "$pidfile"

# If pidfile contains PID and PID is valid
if [ -n "$PID" ] && ps "$PID" > /dev/null 2>&1
then
echo "$PID"
return 0
fi

fi

# pidfile/pid not found, or process is dead
return 1

}

start() {
[ -x $exec ] || exit 5
echo -n "Starting $prog: "

getpid > /dev/null || $exec -p "$pidfile"
retval=$?

case "$retval" in
0)
echo "SUCCESS"
;;
*)
echo "FAIL"
;;
esac

return $retval
}

stop() {
echo -n "Stopping $prog: "

PID=`getpid`
retval=$?

case "$retval" in
0)
if kill $PID > /dev/null 2>&1
then
echo "SUCCESS"
return 0
fi

echo "FAIL"
return 1
;;
*)
echo "SUCCESS (not running)"
return 0
;;
esac

}

restart() {
stop && start
}

force_reload() {
restart
}

status() {

PID=`getpid`
retval=$?

case "$retval" in
0)
echo "$prog is running with PID=$PID."
;;
*)
echo "$prog is not running."
;;
esac

return $retval

}

case "$1" in
start|stop|status|restart|force-reload)
$1
;;
try-restart)
status && restart
;;
*)
echo "Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
exit 2
esac
exit $?

-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
 Eskimo North Linux Friendly Internet Access, Shell Accounts, and Hosting.
   Knowledgeable human assistance, not telephone trees or script readers.
 See our web site: 

Re: guacd startup

2019-03-10 Thread Lev Dubinets
This looks like an init.d script, not a systemd unit. My understanding was that 
the --with-systemd flag should make guacd install an actual systemd unit.


From: Robert Dinse 
Sent: Saturday, March 9, 2019 11:51 PM
To: user@guacamole.apache.org
Subject: Re: guacd startup


#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   
https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apache.org%2Flicenses%2FLICENSE-2.0data=02%7C01%7C%7C3a304263f1074fa9068508d6a52d33d7%7C84df9e7fe9f640afb435%7C1%7C0%7C636878010886914636sdata=QeKTklfBVkQIdh1f7vCIXPOirRI0sjQZL1TY4iBC%2FJc%3Dreserved=0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

# guacd
#
# chkconfig:   2345 20 80
# description: Guacamole proxy daemon

### BEGIN INIT INFO
# Provides:  guacd
# Required-Start:$network $syslog
# Required-Stop: $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop:  0 1 6
# Short-Description: Guacamole proxy daemon
# Description: The Guacamole proxy daemon, required to translate remote desktop
protocols into the text-based Guacamole protocol used by the JavaScript
application.
### END INIT INFO

prog="guacd"
exec="/usr/local/sbin/$prog"
pidfile="/var/run/$prog.pid"

# Returns PID of currently running process, if any
getpid() {

 if [ -f "$pidfile" ]
 then

 read PID < "$pidfile"

 # If pidfile contains PID and PID is valid
 if [ -n "$PID" ] && ps "$PID" > /dev/null 2>&1
 then
 echo "$PID"
 return 0
 fi

 fi

 # pidfile/pid not found, or process is dead
 return 1

}

start() {
 [ -x $exec ] || exit 5
 echo -n "Starting $prog: "

 getpid > /dev/null || $exec -p "$pidfile"
 retval=$?

 case "$retval" in
 0)
 echo "SUCCESS"
 ;;
 *)
 echo "FAIL"
 ;;
 esac

 return $retval
}

stop() {
 echo -n "Stopping $prog: "

 PID=`getpid`
 retval=$?

 case "$retval" in
 0)
 if kill $PID > /dev/null 2>&1
 then
 echo "SUCCESS"
 return 0
 fi

 echo "FAIL"
 return 1
 ;;
 *)
 echo "SUCCESS (not running)"
 return 0
 ;;
 esac

}

restart() {
 stop && start
}

force_reload() {
 restart
}

status() {

 PID=`getpid`
 retval=$?

 case "$retval" in
 0)
 echo "$prog is running with PID=$PID."
 ;;
 *)
 echo "$prog is not running."
 ;;
 esac

 return $retval

}

case "$1" in
 start|stop|status|restart|force-reload)
 $1
 ;;
 try-restart)
 status && restart
 ;;
 *)
 echo "Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
 exit 2
esac
exit $?

-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
  Eskimo North Linux Friendly Internet Access, Shell Accounts, and Hosting.
Knowledgeable human assistance, not telephone trees or script readers.
  See our web site: 
https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eskimo.com%2Fdata=02%7C01%7C%7C3a304263f1074fa9068508d6a52d33d7%7C84df9e7fe9f640afb435%7C1%7C0%7C636878010886914636sdata=%2BHCr84%2FyjB8%2BNqjYRg%2FL1f1HrUZpTf0ubw8bSgcC3Cc%3Dreserved=0
 (206) 812-0051 or (800) 246-6874.

On Sun, 10 Mar 2019, Lev Dubinets wrote:

> Date: Sun, 10 Mar 2019 07:26:29 +
> From: Lev Dubinets 
> Reply-To: user@guacamole.apache.org
> To: Robert Dinse ,
> "user@guacamole.apache.org" 
> Subject: Re: guacd startup
>
> Can you paste the contents of your systemd unit file? You should be able to 
> find the location by using `systemctl status guacd` and it will say "Loaded: 
> loaded (...path...)". The contents of the file at that path would be helpful 
> for diagnosing your issue. Also, what Linux distro are you using?
>
> Lev
>
>
> 
> From: Robert Dinse 
> Sent: Saturday, March 9, 2019 11:20 PM
> To: user@guacamole.apache.org
> Subject: guacd startup
>
>
>  I used the --with-systemd or whatever it was to generate a systemd unit.
> If I type:
>
> systemctl start guacd
>
>  Guacd starts.