|
| 1 | +.. Licensed to the Apache Software Foundation (ASF) under one |
| 2 | + or more contributor license agreements. See the NOTICE file |
| 3 | + distributed with this work for additional information |
| 4 | + regarding copyright ownership. The ASF licenses this file |
| 5 | + to you under the Apache License, Version 2.0 (the |
| 6 | + "License"); you may not use this file except in compliance |
| 7 | + with the License. You may obtain a copy of the License at |
| 8 | +
|
| 9 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +
|
| 11 | + Unless required by applicable law or agreed to in writing, |
| 12 | + software distributed under the License is distributed on an |
| 13 | + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | + KIND, either express or implied. See the License for the |
| 15 | + specific language governing permissions and limitations |
| 16 | + under the License. |
| 17 | +
|
| 18 | +.. include:: ../../common.defs |
| 19 | + |
| 20 | +.. _admin-plugins-ja4-fingerprint: |
| 21 | + |
| 22 | +JA4 Fingerprint Plugin |
| 23 | +********************** |
| 24 | + |
| 25 | +Description |
| 26 | +=========== |
| 27 | + |
| 28 | +The JA4 Fingerprint plugin generates TLS client fingerprints based on the JA4 |
| 29 | +algorithm designed by John Althouse. JA4 is the successor to the JA3 |
| 30 | +fingerprinting algorithm and provides improved client identification for TLS |
| 31 | +connections. |
| 32 | + |
| 33 | +A JA4 fingerprint uniquely identifies TLS clients based on characteristics of |
| 34 | +their TLS ClientHello messages, including: |
| 35 | + |
| 36 | +* TLS version |
| 37 | +* ALPN (Application-Layer Protocol Negotiation) preferences |
| 38 | +* Cipher suites offered |
| 39 | +* TLS extensions present |
| 40 | + |
| 41 | +This information can be used for: |
| 42 | + |
| 43 | +* Client identification and tracking |
| 44 | +* Bot detection and mitigation |
| 45 | +* Security analytics and threat intelligence |
| 46 | +* Understanding client TLS implementation patterns |
| 47 | + |
| 48 | +How It Works |
| 49 | +============ |
| 50 | + |
| 51 | +The plugin intercepts TLS ClientHello messages during the TLS handshake and |
| 52 | +generates a JA4 fingerprint consisting of three sections separated by underscores: |
| 53 | + |
| 54 | +**Section a (unhashed)**: Basic information about the client including: |
| 55 | + |
| 56 | + * Protocol (``t`` for TCP, ``q`` for QUIC) |
| 57 | + * TLS version |
| 58 | + * SNI (Server Name Indication) status |
| 59 | + * Number of cipher suites |
| 60 | + * Number of extensions |
| 61 | + * First ALPN value |
| 62 | + |
| 63 | +**Section b (hashed)**: A SHA-256 hash of the sorted cipher suite list |
| 64 | + |
| 65 | +**Section c (hashed)**: A SHA-256 hash of the sorted extension list |
| 66 | + |
| 67 | +Example fingerprint:: |
| 68 | + |
| 69 | + t13d1516h2_8daaf6152771_b186095e22b6 |
| 70 | + |
| 71 | +Key Differences from JA3 |
| 72 | +------------------------- |
| 73 | + |
| 74 | +* Cipher suites and extensions are sorted before hashing for consistency |
| 75 | +* SNI and ALPN information is included in the fingerprint |
| 76 | +* More resistant to fingerprint randomization |
| 77 | + |
| 78 | +Plugin Configuration |
| 79 | +==================== |
| 80 | + |
| 81 | +The plugin operates as a global plugin and has no configuration options. |
| 82 | + |
| 83 | +To enable the plugin, add the following line to :file:`plugin.config`:: |
| 84 | + |
| 85 | + ja4_fingerprint.so |
| 86 | + |
| 87 | +No additional parameters are required or supported. |
| 88 | + |
| 89 | +Plugin Behavior |
| 90 | +=============== |
| 91 | + |
| 92 | +When loaded, the plugin will: |
| 93 | + |
| 94 | +1. **Capture TLS ClientHello**: Intercepts all incoming TLS connections during |
| 95 | + the ClientHello phase |
| 96 | + |
| 97 | +2. **Generate Fingerprint**: Calculates the JA4 fingerprint from the |
| 98 | + ClientHello data |
| 99 | + |
| 100 | +3. **Log to File**: Writes the fingerprint and client IP address to |
| 101 | + ``ja4_fingerprint.log`` |
| 102 | + |
| 103 | +4. **Add HTTP Headers**: Injects the following headers into subsequent HTTP |
| 104 | + requests on the same connection: |
| 105 | + |
| 106 | + * ``ja4``: Contains the JA4 fingerprint |
| 107 | + * ``x-ja4-via``: Contains the proxy name (from ``proxy.config.proxy_name``) |
| 108 | + |
| 109 | +Log Output |
| 110 | +========== |
| 111 | + |
| 112 | +The plugin writes to ``ja4_fingerprint.log`` in the Traffic Server log |
| 113 | +directory (typically ``/var/log/trafficserver/``). |
| 114 | + |
| 115 | +**Log Format**:: |
| 116 | + |
| 117 | + [timestamp] Client IP: <ip_address> JA4: <fingerprint> |
| 118 | + |
| 119 | +**Example**:: |
| 120 | + |
| 121 | + [Jan 29 10:15:23.456] Client IP: 192.168.1.100 JA4: t13d1516h2_8daaf6152771_b186095e22b6 |
| 122 | + [Jan 29 10:15:24.123] Client IP: 10.0.0.50 JA4: t13d1715h2_8daaf6152771_02713d6af862 |
| 123 | + |
| 124 | +Using JA4 Headers in Origin Requests |
| 125 | +===================================== |
| 126 | + |
| 127 | +Origin servers can access the JA4 fingerprint through the injected HTTP header. |
| 128 | +This allows the origin to: |
| 129 | + |
| 130 | +* Make access control decisions based on client fingerprints |
| 131 | +* Log fingerprints for security analysis |
| 132 | +* Track client populations and TLS implementation patterns |
| 133 | + |
| 134 | +The ``x-ja4-via`` header allows origin servers to track which Traffic Server |
| 135 | +proxy handled the request when multiple proxies are deployed. |
| 136 | + |
| 137 | +Debugging |
| 138 | +========= |
| 139 | + |
| 140 | +To enable debug logging for the plugin, set the following in :file:`records.yaml`:: |
| 141 | + |
| 142 | + records: |
| 143 | + diags: |
| 144 | + debug: |
| 145 | + enabled: 1 |
| 146 | + tags: ja4_fingerprint |
| 147 | + |
| 148 | +Debug output will appear in :file:`diags.log` and includes: |
| 149 | + |
| 150 | +* ClientHello processing events |
| 151 | +* Fingerprint generation details |
| 152 | +* Header injection operations |
| 153 | + |
| 154 | +Requirements |
| 155 | +============ |
| 156 | + |
| 157 | +* Traffic Server must be built with TLS support (OpenSSL or BoringSSL) |
| 158 | +* The plugin operates on all TLS connections |
| 159 | + |
| 160 | +Configuration Settings |
| 161 | +====================== |
| 162 | + |
| 163 | +The plugin requires the ``proxy.config.proxy_name`` setting to be configured |
| 164 | +for the ``x-ja4-via`` header. If not set, the plugin will log an error and use |
| 165 | +"unknown" as the proxy name. |
| 166 | + |
| 167 | +To set the proxy name in :file:`records.yaml`:: |
| 168 | + |
| 169 | + records: |
| 170 | + proxy: |
| 171 | + config: |
| 172 | + proxy_name: proxy01 |
| 173 | + |
| 174 | +Limitations |
| 175 | +=========== |
| 176 | + |
| 177 | +* The plugin only operates in global mode (no per-remap configuration) |
| 178 | +* Logging cannot be disabled |
| 179 | +* Raw (unhashed) cipher and extension lists are not logged |
| 180 | +* Non-TLS connections do not generate fingerprints |
| 181 | + |
| 182 | +See Also |
| 183 | +======== |
| 184 | + |
| 185 | +* JA4 Technical Specification: https://github.com/FoxIO-LLC/ja4/blob/main/technical_details/JA4.md |
| 186 | +* JA4 is licensed under the BSD 3-Clause license |
| 187 | + |
| 188 | +Example Configuration |
| 189 | +===================== |
| 190 | + |
| 191 | +Complete example configuration for enabling JA4 fingerprinting: |
| 192 | + |
| 193 | +**plugin.config**:: |
| 194 | + |
| 195 | + ja4_fingerprint.so |
| 196 | + |
| 197 | +**records.yaml**:: |
| 198 | + |
| 199 | + records: |
| 200 | + proxy: |
| 201 | + config: |
| 202 | + proxy_name: proxy-01 |
| 203 | + diags: |
| 204 | + debug: |
| 205 | + enabled: 1 |
| 206 | + tags: ja4_fingerprint |
| 207 | + |
| 208 | +After restarting Traffic Server, the plugin will begin fingerprinting TLS |
| 209 | +connections and logging to ``ja4_fingerprint.log``. |
0 commit comments