Hitch Service Failed to Start | Hitch 1.5.2-1 | Ubuntu 20.04.1 LTS

1.2k views Asked by At

I have installed Hitch "TLS proxy" in Ubuntu 20.01.1 using sudo apt-get install hitch. When I try to start the service I get the following >

     Loaded: loaded (/etc/systemd/system/hitch.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2020-10-09 12:51:47 EEST; 28s ago
    Process: 176323 ExecStartPre=/usr/sbin/hitch -t $HITCH_OPTIONS (code=exited, status=0/SUCCESS)
    Process: 176337 ExecStart=/usr/sbin/hitch --daemon $HITCH_OPTIONS (code=exited, status=1/FAILURE)

Oct 09 12:51:47 webserver-1 systemd[1]: Starting hitch...
Oct 09 12:51:47 webserver-1 hitch[176323]: Trying to initialize SSL contexts with your certificates
Oct 09 12:51:47 webserver-1 hitch[176323]: hitch configuration looks ok.
Oct 09 12:51:47 webserver-1 systemd[1]: hitch.service: Control process exited, code=exited, status=1/FAILURE
Oct 09 12:51:47 webserver-1 systemd[1]: hitch.service: Failed with result 'exit-code'.
Oct 09 12:51:47 webserver-1 systemd[1]: Failed to start hitch. 

My /etc/hitch/hitch.conf is the following >

tls-protos = TLSv1.2 TLSv1.3

frontend = {
    host = "*"
    port = "443"
}

#When using TCP/IP
backend = "[127.0.0.1]:6086"
workers = 2

# run Varnish as backend over PROXY; varnishd -a :80 -a localhost:6086,PROXY ..
write-proxy-v2 = on

#Using Unix Domain Sockets
#backend = "/run/varnish.sock"
#workers = 2
# We strongly recommend you create a separate non-privileged hitch
# user and group

daemon = on
user = "_hitch"
group = "_hitch"

#ocsp-dir = "/etc/hitch/ocsp"
#ocsp-verify-staple = on

#To generate a certificate use:
# cat cert.key cert.crt cacert.crt > /etc/hitch/certs/site1.com-combined.pe
pem-file = "/etc/letsencrypt/live/sunananas.com/hitch-bundle.pem"

# Enable to let clients negotiate HTTP/2 with ALPN. (default off) (jessie openssl doesn't suppor>
alpn-protos = "h2, http/1.1" 

Also the hitch.service is in use >

[Unit]
Description=hitch
After=syslog.target network.target

[Service]
Type=forking
#PIDFile=/run/hitch/hitch.pid
#Restart=on-failure
LimitNOFILE=131072
Environment="HITCH_OPTIONS=--config /etc/hitch/hitch.conf"
EnvironmentFile=-/etc/hitch/hitch.params
EnvironmentFile=-/etc/default/hitch
EnvironmentFile=-/etc/sysconfig/hitch
ExecStartPre=/usr/sbin/hitch -t $HITCH_OPTIONS
ExecStart=/usr/sbin/hitch --daemon $HITCH_OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target

I saw that /run/hitch/ directory was missing, so I mkdir /run/hitch/ with no success. I also tried to override hitch service using the solution below with the same result.

systemctl edit hitch.service

[Service]
ExecStartPre=-mkdir /run/hitch/
ExecStartPre=-chown hitch:hitch /run/hitch/

Any help is appreciated

1

There are 1 answers

2
Thijs Feryn On BEST ANSWER

Please try running /usr/sbin/hitch --config /etc/hitch/hitch.conf manually on the command line to see what error it is returning.

Watch out: the daemon option is active in hitch.conf which will make debugging harder. Please comment this one out, to ensure Hitch runs in the foreground.

Let me know what the output from this command is, so we can figure out a solution.