title: How do you disable Jenkins CSRF with script?
body: <p>I'm having issues disabling the CSRF protection in an automated fashion. I want to disable with a groovy init script or just in a property file before Jenkins Master Starts. I'm not sure why I'm getting a crumb issue I assume it has to do with the exposed LB in K8S / AWS. I'm using AWS ELB to expose pods and its causing a csrf exception in the crumb, and I also get a reverse proxy warning sometimes when I goto manage Jenkins.</p>
  
  <p>I researched the issue it said I could enable the expanded proxy compatibility or disable the CSRF checking. I haven't found the groovy or config files where these live.</p>
  
  <p>My current groovy init script is as follows:</p>
  
  <pre><code>import hudson.security.csrf.DefaultCrumbIssuer
  import jenkins.model.Jenkins
  
  def j = Jenkins.instance;
  j.setCrumbIssuer(null); // I've also tried setting a new crumb issuer here as well.
  j.save();
  System.setProperty("hudson.security.csrf.CrumbFilter", "false");
  System.setProperty("hudson.security.csrf", "false");
  System.setProperty("hudson.security.csrf.GlobalCrumbIssuerConfiguration", "false");
  </code></pre>
  
  <p>I can't seem to find the reference as to how to disable this property or enable the Enable proxy compatibility property either.</p>
  
  <pre><code>Crumb Algorithm
   Default Crumb Issuer   
          Enable proxy compatibility
  </code></pre>
  
  <p>I intercepted the request to configure when I click apply and the json payload passed seems like the setting is </p>
  
  <pre><code>"hudson-security-csrf-GlobalCrumbIssuerConfiguration": {
      "csrf": {
          "issuer": {
              "value": "0",
              "stapler-class": "hudson.security.csrf.DefaultCrumbIssuer",
              "$class": "hudson.security.csrf.DefaultCrumbIssuer",
              "excludeClientIPFromCrumb": true
          }
      }
  },
  </code></pre>
  
  <p>im not sure what or how I'm supposed to set these.</p>