Page 1 of 1

VPN configuration not working and no logs Guix SD

Posted: Tue Mar 01, 2022 7:22 am
by cloudytechi147
I'm trying to configure my Guix system to automatically connect to my VPN provider by starting the OpenVPN client service but it's failing to start and I can't determine what's going on because there are no logs for the VPN being written to /var/log/. I also looked for VPN logs in /var/log/guix-daemon.log but it's not showing anything relevant to start the VPN service.

Unfortunately, Shepherd doesn't provide much information (that I've been able to find) about the specific failure - i.e. there's no verbose option, or anything, that I can use to determine what is going wrong.

My VPN configuration in my system configuration is this:

Code: Select all

 #:config (openvpn-client-configuration
           (proto 'tcp)
           (ca 'disabled)
           (cert 'disabled)
           (key 'disabled)
           (auth-user-pass "/path/to/my/user/credentials")
           (comp-lzo? #f)
           (fast-io? #t)
           (remote (map (lambda (ip)
                           (name ip)
                           (port 443)))
                        '("IP address 1" "IP address 2")))))
From looking at the VPN-specific Info manual, I don't see where I'm going wrong. Any assistance in either of the two below items is greatly appreciated:

Finding out how to force shepherd to write logs.
Determining why my config isn't working.

I forgot to mention that I think the logs issue might be due to a bug in the following function in vpn.scm (but I'm still not familiar enough with Guix/Shepherd to know if it's actually a bug, or not and used the 7 layers of osi mode too):

Notice that log-file is declared but not actually used - unless it's used in a macro expansion, or something, that I'm not seeing.

Code: Select all

(define (openvpn-shepherd-service role)
  (lambda (config)
    (let* ((config-file (openvpn-config-file role config))
           (pid-file ((match role
                        ('server openvpn-server-configuration-pid-file)
                        ('client openvpn-client-configuration-pid-file))
           (openvpn ((match role
                       ('server openvpn-server-configuration-openvpn)
                       ('client openvpn-client-configuration-openvpn))
           (log-file (match role
                       ('server "/var/log/openvpn-server.log")
                       ('client "/var/log/openvpn-client.log"))))
      (list (shepherd-service
             (documentation (string-append "Run the OpenVPN "
                                           (match role
                                             ('server "server")
                                             ('client "client"))
                                           " daemon."))
             (provision (match role
                          ('server '(vpn-server))
                          ('client '(vpn-client))))
             (requirement '(networking))
             (start #~(make-forkexec-constructor
                       (list (string-append #$openvpn "/sbin/openvpn")
                             "--writepid" #$pid-file "--config" #$config-file
                       #:pid-file #$pid-file))
             (stop #~(make-kill-destructor)))))))