]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Fortinet: set HTTP user-agent to 'Mozilla/5.0 SV1' as openfortivpn does
authorDaniel Lenski <dlenski@gmail.com>
Wed, 3 Feb 2021 06:57:52 +0000 (22:57 -0800)
committerDaniel Lenski <dlenski@gmail.com>
Mon, 29 Mar 2021 03:13:30 +0000 (20:13 -0700)
This appears to suppress the need for 'host check' (presumably a
Trojan similar to those of other protocols) on some, if not all,
Fortinet servers.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
fortinet.c
library.c
openconnect-internal.h

index 2e980535d7825e4f0c71a36cefecc35fe44b4955..c014fe96fda88e7f9d87a64f4b06f20cf8b57e88 100644 (file)
 
 #define XCAST(x) ((const xmlChar *)(x))
 
+void fortinet_common_headers(struct openconnect_info *vpninfo,
+                        struct oc_text_buf *buf)
+{
+       char *orig_ua = vpninfo->useragent;
+
+       /* XX: This is what openfortivpn uses */
+       vpninfo->useragent = (char *)"Mozilla/5.0 SV1";
+       http_common_headers(vpninfo, buf);
+       vpninfo->useragent = orig_ua;
+}
+
 int fortinet_obtain_cookie(struct openconnect_info *vpninfo)
 {
        return -EINVAL;
@@ -297,7 +308,7 @@ int fortinet_connect(struct openconnect_info *vpninfo)
                goto out;
        reqbuf = buf_alloc();
        buf_append(reqbuf, "GET /remote/sslvpn-tunnel HTTP/1.1\r\n");
-       http_common_headers(vpninfo, reqbuf);
+       fortinet_common_headers(vpninfo, reqbuf);
        buf_append(reqbuf, "\r\n");
 
        if (buf_error(reqbuf)) {
index f9f203a0b1814ca15d487de421dca47f71a1d8ee..6558d6c094036ca192840ecc58877574b8e5dc33 100644 (file)
--- a/library.c
+++ b/library.c
@@ -216,7 +216,7 @@ static const struct vpn_proto openconnect_protos[] = {
                .vpn_close_session = fortinet_bye,
                .tcp_connect = fortinet_connect,
                .tcp_mainloop = ppp_mainloop,
-               .add_http_headers = http_common_headers,
+               .add_http_headers = fortinet_common_headers,
                .obtain_cookie = fortinet_obtain_cookie,
                .secure_cookie = "SVPNCOOKIE",
                .udp_protocol = "DTLS",
index 544a4f4e16c482042198c6742f7aa1dace4a2b85..63a0eefe3d74481d2c3e61d589e02b7ba0f64d02 100644 (file)
@@ -991,6 +991,7 @@ int f5_connect(struct openconnect_info *vpninfo);
 int f5_bye(struct openconnect_info *vpninfo, const char *reason);
 
 /* fortinet.c */
+void fortinet_common_headers(struct openconnect_info *vpninfo, struct oc_text_buf *buf);
 int fortinet_obtain_cookie(struct openconnect_info *vpninfo);
 int fortinet_connect(struct openconnect_info *vpninfo);
 int fortinet_bye(struct openconnect_info *vpninfo, const char *reason);