Pages

Wednesday, December 15, 2021

Faille log4j & elasticsearch 6.8.*


Pour corriger la faille de sécurité dans Elasticsearch, nous avons mis à jour le paquage Debian et ainsi passer de la version 6.8.20 à 6.8.21. Nous nous sommes rendus comptes qu'il restait un jar impacté par la faille : /usr/share/elasticsearch/lib/log4j-core-2.11.1.jar 

A priori, d'après les discussions, il n'y a pas de risques (https://discuss.elastic.co/t/zero-day-exploit-in-log4j2-which-is-part-of-elasticsearch/291439/63)

Toutefois afin de prendre toues les précautions, nous avons remplacé les versions impactés par la bonne version de log4j. Le seul effet de bord possible serait un problème de permission : “Probably permissions issue. That's why Elasticsearch is not starting. If you have removed class from the jar, check the permissions of the jar and make sure it is elasticsearch:elasticsearch or whatever it was before.”

Voici les commandes utilisées :

cd /tmp/
wget https://dlcdn.apache.org/logging/log4j/2.16.0/apache-log4j-2.16.0-bin.tar.gz
tar xvzf apache-log4j-2.16.0-bin.tar.gz
mkdir /tmp/log4j/old
cd /usr/share/elasticsearch/lib/
mv log4j-1.2-api-2.11.1.jar /tmp/log4j/old/
mv log4j-api-2.11.1.jar /tmp/log4j/old/
mv log4j-core-2.11.1.jar /tmp/log4j/old/
cp /tmp/apache-log4j-2.16.0-bin/log4j-1.2-api-2.16.0.jar .
cp /tmp/apache-log4j-2.16.0-bin/log4j-api-2.16.0.jar .
cp /tmp/apache-log4j-2.16.0-bin/log4j-core-2.16.0.jar .
systemctl stop elasticsearch
systemctl stop elasticsearch
tail -f /var/log/elasticsearch/elasticsearch.log
systemctl restart apache2

Saturday, November 6, 2021

Docker : COPY failed: file not found in build context or excluded by .dockerignore



I wanted copy /root/master directory in /var/  like this : cp -R /root/master /var/

However, I had the following error : COPY failed: file not found in build context or excluded by .dockerignore

I found the solution on Stackoverflow :

The <src> path must be inside the context of the build; you cannot COPY ../something /something, because the first step of a docker build is to send the context directory (and subdirectories) to the docker daemon.

In fact, I needed to copy the master directory in a Docker sub folder because I used a docker-compose.yml with services:

version: "3"
services:
  master:
    container_name: master
    env_file:
      - variables.env
    build:
        context: ./subdirectory1/
        dockerfile: Dockerfile
        args:

 My structure folders :

docker-compose.yml 
subdirectory1/
DockerFile
        master/
subdirectory2
DockerFile


So in your DockerFile, add the following :

RUN mkdir -p /var
WORKDIR /var

To copy the whole directory :
COPY ./master .

To copy subdirectories :
COPY ./master/ .

Docker version 20.10.8, build 3967b7d

Saturday, October 16, 2021

Reminder : undo git add command


Just to remember a simple command...

Add a file in order to be managed by GIT : 

git add filename

If you want to undo the git add command  :

git reset file

PlayConsole : suppression des warnings lors de la publication (minify, symbole de debogage...)

Lors de la publication des versions dans la PlayConsole, j'avais 2 warnings pour indiquer qu'il était possible de réduire et d'o...