<commit_before>#!/bin/bash
########################################################
CA_CERT=ca.pem
CA_KEY=ca-key.pem
CLIENT_CERT=cert.pem
CLIENT_KEY=key.pem
SERVER_CERT=server.pem
SERVER_KEY=server-key.pem
PASSPHRASE=changeit

# Origin from https://raw.githubusercontent.com/ksahnine/docker/master/gen-docker-certs.sh

if [[ $USER != "admincu" ]]; then
    echo "This script must be run as admincu"
    exit 1
fi

dhostname="localhost"
dip="172.17.42.1"

## Clean
sudo rm -f *.pem

## Generation du certificat CA
sudo openssl genrsa -aes256 -passout pass:$PASSPHRASE -out $CA_KEY 2048
sudo openssl req -new -x509 -days 365 -key $CA_KEY -sha256 -passin pass:$PASSPHRASE -subj "/C=FR/ST=MyState/O=Treeptik" -out $CA_CERT

## Generation du certificat Serveur
sudo openssl genrsa -out $SERVER_KEY 2048
sudo openssl req -subj "/CN=${dhostname}" -new -key $SERVER_KEY -out server.csr 2>/dev/null
echo subjectAltName = IP:${dip} > extfile.cnf
sudo openssl x509 -passin pass:$PASSPHRASE -req -days 365 -in server.csr -CA $CA_CERT -CAkey $CA_KEY -CAcreateserial -out $SERVER_CERT -extfile extfile.cnf

## Generation du certificat Client
sudo openssl genrsa -out $CLIENT_KEY 2048
sudo openssl req -subj '/CN=client' -new -key $CLIENT_KEY -out client.csr 2>/dev/null
echo extendedKeyUsage = clientAuth > extfile.cnf
sudo openssl x509 -passin pass:$PASSPHRASE -req -days 365 -in client.csr -CA $CA_CERT -CAkey $CA_KEY -CAcreateserial -out $CLIENT_CERT -extfile extfile.cnf

## Nettoyage
sudo rm -f client.csr server.csr extfile.cnf ca.srl
sudo chmod 0400 $CA_KEY $CLIENT_KEY $SERVER_KEY<commit_msg>Update install with TLS socket<commit_after>#!/bin/bash
########################################################
CA_CERT=ca.pem
CA_KEY=ca-key.pem
CLIENT_CERT=cert.pem
CLIENT_KEY=key.pem
SERVER_CERT=server.pem
SERVER_KEY=server-key.pem
PASSPHRASE=changeit

# Origin from https://raw.githubusercontent.com/ksahnine/docker/master/gen-docker-certs.sh

if [[ $USER != "root" ]]; then
    echo "This script must be run as admincu"
    exit 1
fi

dhostname="localhost"
dip="172.17.42.1"

## Clean
sudo rm -f *.pem

## Generation du certificat CA
sudo openssl genrsa -aes256 -passout pass:$PASSPHRASE -out $CA_KEY 2048
sudo openssl req -new -x509 -days 365 -key $CA_KEY -sha256 -passin pass:$PASSPHRASE -subj "/C=FR/ST=MyState/O=Treeptik" -out $CA_CERT

## Generation du certificat Serveur
sudo openssl genrsa -out $SERVER_KEY 2048
sudo openssl req -subj "/CN=${dhostname}" -new -key $SERVER_KEY -out server.csr 2>/dev/null
echo subjectAltName = IP:${dip} > extfile.cnf
sudo openssl x509 -passin pass:$PASSPHRASE -req -days 365 -in server.csr -CA $CA_CERT -CAkey $CA_KEY -CAcreateserial -out $SERVER_CERT -extfile extfile.cnf

## Generation du certificat Client
sudo openssl genrsa -out $CLIENT_KEY 2048
sudo openssl req -subj '/CN=client' -new -key $CLIENT_KEY -out client.csr 2>/dev/null
echo extendedKeyUsage = clientAuth > extfile.cnf
sudo openssl x509 -passin <PASSWORD>:$<PASSWORD> -req -days 365 -in client.csr -CA $CA_CERT -CAkey $CA_KEY -CAcreateserial -out $CLIENT_CERT -extfile extfile.cnf

## Nettoyage
sudo rm -f client.csr server.csr extfile.cnf ca.srl
sudo chmod 0400 $CA_KEY $CLIENT_KEY $SERVER_KEY
{'fraction_non_alphanumeric': 0.14786967418546365, 'fraction_numerical': 0.03195488721804511, 'mean_word_length': 4.651327433628318, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6695456', 'n_tokens_mistral': 1303, 'n_tokens_neox': 1201, 'n_words': 331}