<commit_before>#! /usr/bin/bash

export HOST=itsftp-test.usc.edu

#  on the Docker daemon’s host machine, generate CA private and public keys
openssl genrsa -aes256 -out ca-key.pem 4096
openssl req -new -x509 -days 365 -key ca-key.pem -sha256 -out ca.pem

# create a server key and certificate signing request (CSR).
# Make sure that “Common Name” matches the hostname you use to connect to Docker
openssl genrsa -out server-key.pem 4096
openssl req -subj "/CN=$HOST" -sha256 -new -key server-key.pem -out server.csr

echo subjectAltName = DNS:$HOST,IP:10.10.10.20,IP:127.0.0.1 >> extfile.cnf
echo extendedKeyUsage = serverAuth >> extfile.cnf

openssl x509 -req -days 365 -sha256 -in server.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out server-cert.pem -extfile extfile.cnf

# For client authentication, create a client key and certificate signing request:

openssl genrsa -out key.pem 4096
openssl req -subj '/CN=client' -new -key key.pem -out client.csr

echo extendedKeyUsage = clientAuth >> extfile.cnf
openssl x509 -req -days 365 -sha256 -in client.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out cert.pem -extfile extfile.cnf

rm -v client.csr server.csr
chmod -v 0400 ca-key.pem key.pem server-key.pem
chmod -v 0444 ca.pem server-cert.pem cert.pem

cp cert.pem key.pem ca.pem client-certs/
cp server-key.pem server-cert.pem ca.pem server-certs/
rm -v cert.pem key.pem ca.pem server-key.pem server-cert.pem<commit_msg>Fix docker cert creation<commit_after>export HOST=host.usc.edu
export PASSWORD=password
export COUNTRY=US
export STATE=California
export CITY=Los\ Angeles
export ORGANIZATION=University\ of\ Southern\ California
export UNIT=Information\ Technology\ Services
export EMAIL=<EMAIL>
export OTHER_HOSTS=DNS:$HOST,DNS:host1.usc.edu,DNS:host2.usc.edu,DNS:host3.usc.edu,IP:127.0.0.1

#  on the Docker daemon’s host machine, generate CA private and public keys
openssl genrsa -aes256 -out ca-key.pem 4096

openssl req -new -x509 -days 365 -subj "/C=$COUNTRY/ST=$STATE/L=$CITY/O=$ORGANIZATION/OU=$UNIT/CN=$HOST" -key ca-key.pem -sha256 -out ca.pem

# create a server key and certificate signing request (CSR).
# Make sure that “Common Name” matches the hostname you use to connect to Docker
openssl genrsa -out server-key.pem 4096
openssl req -subj "/CN=$HOST" -sha256 -new -key server-key.pem -out server.csr

echo subjectAltName = $OTHER_HOSTS >> extfile.cnf
echo extendedKeyUsage = serverAuth >> extfile.cnf

openssl x509 -req -days 365 -sha256 -in server.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out server-cert.pem -extfile extfile.cnf

# For client authentication, create a client key and certificate signing request:

openssl genrsa -out key.pem 4096
openssl req -subj '/CN=client' -new -key key.pem -out client.csr

echo extendedKeyUsage = clientAuth >> extfile.cnf
openssl x509 -req -days 365 -sha256 -in client.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out cert.pem -extfile extfile.cnf

rm -v client.csr server.csr
chmod -v 0400 ca-key.pem key.pem server-key.pem
chmod -v 0444 ca.pem server-cert.pem cert.pem

mkdir client-certs
mkdir server-certs
cp cert.pem key.pem ca.pem client-certs/
cp server-key.pem server-cert.pem ca.pem server-certs/
rm -vf cert.pem key.pem ca.pem server-key.pem server-cert.pem
rm -vf ca-key.pem ca.srl cert.pem extfile.cnf
{'fraction_non_alphanumeric': 0.10795282733595404, 'fraction_numerical': 0.039008164499546416, 'mean_word_length': 3.893491124260355, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 3, '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': '2338141', 'n_tokens_mistral': 1339, 'n_tokens_neox': 1212, 'n_words': 384}