Skip to content

Instantly share code, notes, and snippets.

@jasonwbarnett
Last active December 11, 2021 01:03
Show Gist options
  • Select an option

  • Save jasonwbarnett/f18a8e04533b8b8d63ae3609171a7128 to your computer and use it in GitHub Desktop.

Select an option

Save jasonwbarnett/f18a8e04533b8b8d63ae3609171a7128 to your computer and use it in GitHub Desktop.

Revisions

  1. jasonwbarnett revised this gist Dec 11, 2021. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -16,4 +16,6 @@ sudo ps -ef | grep -i elastic

    If you see an elasticsearch process than this fix will most likley work for you.

    If you're running an older version of Chef Infra Server you might not even be effected by the vulnerability because the solr instance uses log4j 1.x which, according to some articles, doesn't have the vulnerability.
    If you're running an older version of Chef Infra Server you might not even be effected by the vulnerability because the solr instance uses log4j 1.x which, according to some [articles][1], doesn't have the vulnerability.

    [1]: https://www.randori.com/blog/cve-2021-44228/
  2. jasonwbarnett revised this gist Dec 11, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -16,4 +16,4 @@ sudo ps -ef | grep -i elastic

    If you see an elasticsearch process than this fix will most likley work for you.

    If you're running an older version of Chef Infra Server you might not even been effected by the vulnerability because the solr instance used log4j 1.x which, according to some articles, doesn't have the vulnerability.
    If you're running an older version of Chef Infra Server you might not even be effected by the vulnerability because the solr instance uses log4j 1.x which, according to some articles, doesn't have the vulnerability.
  3. jasonwbarnett revised this gist Dec 11, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ If for some reason you can't upgrade soon here is an alternative. I highly recom

    This only works if you're using a version of Chef Infra Server that ships with elasticsearch. If you're using an old version of Chef Infra Server that is still using solr this won't work.

    Quickly validate with you're using a moden version of Chef Infra Server:
    Quickly validate that you're using a moden version of Chef Infra Server:

    ```bash
    sudo ps -ef | grep -i elastic
  4. jasonwbarnett revised this gist Dec 11, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ Chef Progress has already begun working on a fix that will be released in the ne

    If for some reason you can't upgrade soon here is an alternative. I highly recommend upgrading instead of using this fix. This fix is meant to be a stop gap solution.

    # Alternative Fix
    ## Alternative Fix

    This only works if you're using a version of Chef Infra Server that ships with elasticsearch. If you're using an old version of Chef Infra Server that is still using solr this won't work.

  5. jasonwbarnett revised this gist Dec 11, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    Chef Progress has already begun working on a fix that will be released in the next Chef Infra Server release, see: https://github.com/chef/chef-server/pull/2992

    If for some reason you can't upgrade soon here is an alternative. I highly recommend upgrading instead of using this fix. This fix is meant as a stop gap solution.
    If for some reason you can't upgrade soon here is an alternative. I highly recommend upgrading instead of using this fix. This fix is meant to be a stop gap solution.

    # Alternative Fix

  6. jasonwbarnett revised this gist Dec 11, 2021. 1 changed file with 10 additions and 2 deletions.
    12 changes: 10 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,19 @@
    # Update
    # Overview

    Chef Progress has already begun working on a fix that will be released in the next Chef Infra Server release, see: https://github.com/chef/chef-server/pull/2992

    If for some reason you can't upgrade soon here is an alternative. I highly recommend upgrading instead of using this fix. This fix is meant as a stop gap solution.

    # Alternative Fix

    This only works if you're using a version of Chef Infra Server that ships with elasticsearch. If you're using an old version of Chef Infra Server that is still using solr this won't work.

    Quickly validate with:
    Quickly validate with you're using a moden version of Chef Infra Server:

    ```bash
    sudo ps -ef | grep -i elastic
    ```

    If you see an elasticsearch process than this fix will most likley work for you.

    If you're running an older version of Chef Infra Server you might not even been effected by the vulnerability because the solr instance used log4j 1.x which, according to some articles, doesn't have the vulnerability.
  7. jasonwbarnett renamed this gist Dec 11, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  8. jasonwbarnett revised this gist Dec 11, 2021. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -8,4 +8,4 @@ Quickly validate with:
    sudo ps -ef | grep -i elastic
    ```

    If you see an elasticsearch process than this fix will most likley work for you.
    If you see an elasticsearch process than this fix will most likley work for you.
    2 changes: 1 addition & 1 deletion update.sh
    Original file line number Diff line number Diff line change
    @@ -16,4 +16,4 @@ sudo chef-server-ctl restart elasticsearch

    # Validate
    sudo tail -n10 /var/opt/opscode/elasticsearch/config/jvm.options
    sudo ps -ef | grep formatMsgNoLookups
    sudo ps -ef | grep formatMsgNoLookups
  9. jasonwbarnett revised this gist Dec 11, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion update.sh
    Original file line number Diff line number Diff line change
    @@ -16,4 +16,4 @@ sudo chef-server-ctl restart elasticsearch

    # Validate
    sudo tail -n10 /var/opt/opscode/elasticsearch/config/jvm.options
    sudo ps -ef | grep elastic | grep formatMsgNoLookups
    sudo ps -ef | grep formatMsgNoLookups
  10. jasonwbarnett revised this gist Dec 11, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion update.sh
    Original file line number Diff line number Diff line change
    @@ -15,4 +15,5 @@ sudo chef-server-ctl reconfigure
    sudo chef-server-ctl restart elasticsearch

    # Validate
    sudo tail -n10 /var/opt/opscode/elasticsearch/config/jvm.options
    sudo tail -n10 /var/opt/opscode/elasticsearch/config/jvm.options
    sudo ps -ef | grep elastic | grep formatMsgNoLookups
  11. jasonwbarnett revised this gist Dec 11, 2021. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,11 @@
    # Update

    This only works if you're using a version of Chef Infra Server that ships with elasticsearch. If you're using an old enough version of Chef Infra Server that it's still using solr this won't work.
    This only works if you're using a version of Chef Infra Server that ships with elasticsearch. If you're using an old version of Chef Infra Server that is still using solr this won't work.

    Quickly validate with:

    ```bash
    sudo ps -ef | grep -i elastic
    ```

    If you see an elasticsearch process than this fix will most likley work for you.
  12. jasonwbarnett revised this gist Dec 11, 2021. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion update.sh
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,6 @@ eof

    sudo chef-server-ctl reconfigure
    sudo chef-server-ctl restart elasticsearch
    sudo tail -15 /opt/opscode/embedded/cookbooks/private-chef/templates/default/elasticsearch_jvm.opts.erb

    # Validate
    sudo tail -n10 /var/opt/opscode/elasticsearch/config/jvm.options
  13. jasonwbarnett revised this gist Dec 11, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions update.sh
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,7 @@ cat <<'eof' | sudo tee -a /opt/opscode/embedded/cookbooks/private-chef/templates
    -Dlog4j2.formatMsgNoLookups=true
    eof

    sudo chef-server-ctl reconfigure
    sudo chef-server-ctl restart elasticsearch
    sudo tail -15 /opt/opscode/embedded/cookbooks/private-chef/templates/default/elasticsearch_jvm.opts.erb
  14. jasonwbarnett created this gist Dec 11, 2021.
    3 changes: 3 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    # Update

    This only works if you're using a version of Chef Infra Server that ships with elasticsearch. If you're using an old enough version of Chef Infra Server that it's still using solr this won't work.
    15 changes: 15 additions & 0 deletions update.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/bin/bash

    sudo cp -a /opt/opscode/embedded/cookbooks/private-chef/templates/default/elasticsearch_jvm.opts.erb /opt/opscode/embedded/cookbooks/private-chef/templates/default/elasticsearch_jvm.opts.erb-bak

    cat <<'eof' | sudo tee -a /opt/opscode/embedded/cookbooks/private-chef/templates/default/elasticsearch_jvm.opts.erb
    ## RCE 0-day exploit found in log4j, a popular Java logging package
    #https://www.randori.com/blog/cve-2021-44228/
    #https://github.com/elastic/elasticsearch/issues/81618
    -Dlog4j2.formatMsgNoLookups=true
    eof
    sudo chef-server-ctl reconfigure
    sudo chef-server-ctl restart elasticsearch
    sudo tail -15 /opt/opscode/embedded/cookbooks/private-chef/templates/default/elasticsearch_jvm.opts.erb