]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
recent tncc.jar looks for files in ~/.pulse_secure rather than ~/.juniper_networks
authorDaniel Lenski <dlenski@gmail.com>
Thu, 2 Apr 2020 04:46:42 +0000 (21:46 -0700)
committerDaniel Lenski <dlenski@gmail.com>
Wed, 8 Apr 2020 02:49:40 +0000 (19:49 -0700)
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
trojans/tncc-wrapper.py
www/changelog.xml

index 8e5c263c6c2c5ae0b95f4381d2ede407729e8fcd..95b118858455cbbaf0f2d90c8c3a7627669dccb7 100755 (executable)
@@ -23,6 +23,14 @@ import zipfile
 import urllib.request
 import ssl
 
+# In order to run this, you will need to build tncc_preload.so (from
+# https://github.com/russdill/ncsvc-socks-wrapper) and place it in this
+# directory.
+#
+# Very old versions of the TNCC Java binary expect to find files in
+# ~/.juniper_networks instead of ~/.pulse_secure
+TNCC_DIRECTORY = "~/.pulse_secure"
+
 ssl._create_default_https_context = ssl._create_unverified_context
 
 class Tncc:
@@ -34,19 +42,19 @@ class Tncc:
             print('WARNING: no IcedTea Java web plugin JAR found at %s' % self.plugin_jar, file=sys.stderr)
             self.plugin_jar = None
         self.user_agent = 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1'
-        
+
     def tncc_init(self):
         class_names = ('net.juniper.tnc.NARPlatform.linux.LinuxHttpNAR',
                        'net.juniper.tnc.HttpNAR.HttpNAR')
         self.class_name = None
 
-        self.tncc_jar = os.path.expanduser('~/.juniper_networks/tncc.jar')
+        self.tncc_jar = os.path.expanduser(os.path.join(TNCC_DIRECTORY, 'tncc.jar'))
         try:
             if zipfile.ZipFile(self.tncc_jar, 'r').testzip() is not None:
                 raise Exception()
         except:
             print('Downloading tncc.jar...')
-            os.makedirs(os.path.expanduser('~/.juniper_networks'), exist_ok=True)
+            os.makedirs(os.path.expanduser(TNCC_DIRECTORY), exist_ok=True)
             urllib.request.urlretrieve('https://' + self.vpn_host
                                        + '/dana-cached/hc/tncc.jar', self.tncc_jar)
 
@@ -62,7 +70,7 @@ class Tncc:
                 raise Exception('Could not find class name for', self.tncc_jar)
 
         self.tncc_preload = \
-            os.path.expanduser('~/.juniper_networks/tncc_preload.so')
+            os.path.expanduser(os.path.join(TNCC_DIRECTORY, 'tncc_preload.so'))
         if not os.path.isfile(self.tncc_preload):
             print('WARNING: no tncc_preload found at %s' % self.tncc_preload, file=sys.stderr)
             self.tncc_preload = None
@@ -91,12 +99,12 @@ class Tncc:
             ], env={'LD_PRELOAD': self.tncc_preload} if self.tncc_preload else {})
 
 
-        
+
 if __name__ == "__main__":
     if len(sys.argv) <= 1:
         print("Usage: %s [vpn-host]" % sys.argv[0])
         raise SystemExit(1)
-        
+
     tncc = Tncc(sys.argv[1])
     tncc.tncc_init()
     tncc.tncc_start()
index 2d2dc07021c7a71162c5d73d0ed1510bcd9b543a..7def3d43375ba0716cc1d8618350d343727de7d7 100644 (file)
@@ -17,6 +17,7 @@
      <ul>
        <li>Don't abort Pulse connection when server-provided certificate MD5 doesn't match.</li>
        <li>Fix off-by-one in check for bad GnuTLS versions, and add build and run time checks.</li>
+       <li>Convert <tt>tncc-wrapper.py</tt> to Python 3.</li>
      </ul><br/>
   </li>
   <li><b><a href="ftp://ftp.infradead.org/pub/openconnect/openconnect-8.06.tar.gz">OpenConnect v8.06</a></b>