]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
more logging around Trojan script invocation (CSD/HIP/TNCC)
authorDaniel Lenski <dlenski@gmail.com>
Mon, 30 Nov 2020 06:41:12 +0000 (22:41 -0800)
committerDaniel Lenski <dlenski@gmail.com>
Tue, 1 Dec 2020 22:07:46 +0000 (14:07 -0800)
See #203 for a recent example of where it wasn't clear that a problem was
caused by a CSD script being invoked and never returning, due to the lack of
logging.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
auth-juniper.c
auth.c
gpst.c

index 492cef522e5764792f332a38ad1336e0fb9504bb..dc4f836b2cf497fa9e305346b4a0ef2c427fac55 100644 (file)
@@ -404,6 +404,10 @@ static int tncc_preauth(struct openconnect_info *vpninfo)
                return -EINVAL;
        }
 
+       vpn_progress(vpninfo, PRG_INFO,
+                    _("Trying to run TNCC/Host Checker Trojan script '%s'.\n"),
+                    vpninfo->csd_wrapper);
+
 #ifdef SOCK_CLOEXEC
        if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sockfd))
 #endif
diff --git a/auth.c b/auth.c
index c07ed15b3b780e8e3961699097570423dcd71a3f..9756018b6d5a423896db22390f92031ab57d91d8 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -1069,11 +1069,6 @@ static int run_csd_script(struct openconnect_info *vpninfo, char *buf, int bufle
                return -EPERM;
        }
 
-#ifndef __linux__
-       vpn_progress(vpninfo, PRG_INFO,
-                    _("Trying to run Linux CSD trojan script.\n"));
-#endif
-
        fname[0] = 0;
        if (buflen) {
                struct oc_vpn_option *opt;
@@ -1123,6 +1118,10 @@ static int run_csd_script(struct openconnect_info *vpninfo, char *buf, int bufle
                close(fd);
        }
 
+       vpn_progress(vpninfo, PRG_INFO,
+                    _("Trying to run CSD Trojan script '%s'.\n"),
+                    vpninfo->csd_wrapper ?: fname);
+
        child = fork();
        if (child == -1) {
                goto out;
@@ -1145,6 +1144,10 @@ static int run_csd_script(struct openconnect_info *vpninfo, char *buf, int bufle
                                vpn_progress(vpninfo, PRG_ERR,
                                             _("Authentication may fail. If your script is not returning zero, fix it.\n"
                                               "Future versions of openconnect will abort on this error.\n"));
+                       } else {
+                               vpn_progress(vpninfo, PRG_INFO,
+                                            _("CSD script '%s' completed successfully.\n"),
+                                            vpninfo->csd_wrapper ?: fname);
                        }
 
                        free(vpninfo->urlpath);
@@ -1424,7 +1427,10 @@ newgroup:
                                        result = -EINVAL;
                                        goto out;
                                }
-                       }
+                       } else
+                               vpn_progress(vpninfo, PRG_INFO,
+                                            _("Fetched CSD stub for %s platform (size is %d bytes).\n"),
+                                            vpninfo->platname, buflen);
                }
 
                /* This is the CSD stub script, which we now need to run */
diff --git a/gpst.c b/gpst.c
index e6491a58965b34bfef44fe2868e5d159a3dd5270..aedff46e167950d114e0dc6f62c9c3d28d44e80b 100644 (file)
--- a/gpst.c
+++ b/gpst.c
@@ -955,6 +955,11 @@ static int run_hip_script(struct openconnect_info *vpninfo)
                     _("Error: Running the 'HIP Report' script on this platform is not yet implemented.\n"));
        return -EPERM;
 #else
+
+       vpn_progress(vpninfo, PRG_INFO,
+                    _("Trying to run HIP Trojan script '%s'.\n"),
+                    vpninfo->csd_wrapper);
+
 #ifdef __linux__
        if (pipe2(pipefd, O_CLOEXEC))
 #endif
@@ -993,6 +998,10 @@ static int run_hip_script(struct openconnect_info *vpninfo)
                                                 vpninfo->csd_wrapper, WEXITSTATUS(status));
                        ret = -EINVAL;
                } else {
+                       vpn_progress(vpninfo, PRG_INFO,
+                                    _("HIP script '%s' completed successfully (report is %d bytes).\n"),
+                                    vpninfo->csd_wrapper, report_buf->pos);
+
                        ret = check_or_submit_hip_report(vpninfo, report_buf->data);
                        if (ret < 0)
                                vpn_progress(vpninfo, PRG_ERR, _("HIP report submission failed.\n"));