<commit_before>#!/bin/bash

# Install irods&friends
/install

yes $IRODS_PASS | sudo -S echo "test"
touch /tmp/answers

# # Launch irods after install
# yes $IRODS_PASS | sudo -S /etc/init.d/irods start

################################
## Create and sign a user certificate on the iRODS server side

## Authority: there should be already one, see:
# grid-default-ca

# echo "1" > /tmp/answers
# sudo grid-ca-create -noint -dir /etc/grid-security/simpleca
# sudo mkdir -p /var/lib/globus
# sudo ln -s /etc/grid-security/simpleca /var/lib/globus/simple_ca
# sudo grid-default-ca < /tmp/answers

################################
## Host certificates
echo "y" > /tmp/answers
sudo grid-cert-request -host $HOSTNAME -force < /tmp/answers
echo "globus" > /tmp/answers
sudo grid-ca-sign -dir /etc/grid-security/simpleca \
        -in /etc/grid-security/hostcert_request.pem \
        -out /etc/grid-security/hostcert.pem < /tmp/answers

################################
## Fix volume permissions for irods/gsi
sudo chown $IRODS_USER:$IRODS_USER -R /etc/grid-security

#########################################################
## CERTIFICATES
certdir="/opt/certificates"
mkdir -p $certdir && sudo chown $IRODS_USER /opt/certificates

# Copy current certification authority for other containers
cadir="$certdir/caauth"
if [ ! -d "$cadir" ]; then
    sudo rm -rf $cadir && rsync -avq /etc/grid-security/certificates/ $cadir
    echo "Saved auth for outside containers"
fi

# Add a guest user for GSI certificates
rm -rf /opt/certificates/$GSI_USER \
    && /addusercert $GSI_USER
rm -rf /opt/certificates/$GSI_ADMIN \
    && /addusercert $GSI_ADMIN && iadmin moduser $GSI_ADMIN type rodsadmin

# Fix certificate permissions:
# they have to be owned by the same only user who asks as a client
sudo chown -R $UID:$GROUPS $certdir
<commit_msg>Bug fix certificates<commit_after>#!/bin/bash

# Install irods&friends
/install

yes $IRODS_PASS | sudo -S echo "test"
touch /tmp/answers

# # Launch irods after install
# yes $IRODS_PASS | sudo -S /etc/init.d/irods start

################################
## Create and sign a user certificate on the iRODS server side

## IF NOT EXISTS

## Authority: there should be already one, see:
# grid-default-ca

# echo "1" > /tmp/answers
# sudo grid-ca-create -noint -dir /etc/grid-security/simpleca
# sudo mkdir -p /var/lib/globus
# sudo ln -s /etc/grid-security/simpleca /var/lib/globus/simple_ca
# sudo grid-default-ca < /tmp/answers

## IF EXISTS
sudo ln -s /var/lib/globus/simple_ca /etc/grid-security/simpleca

################################
## Host certificates
echo "y" > /tmp/answers
sudo grid-cert-request -host $HOSTNAME -force < /tmp/answers
echo "globus" > /tmp/answers
sudo grid-ca-sign -dir /etc/grid-security/simpleca \
        -in /etc/grid-security/hostcert_request.pem \
        -out /etc/grid-security/hostcert.pem < /tmp/answers

################################
## Fix volume permissions for irods/gsi
sudo chown $IRODS_USER:$IRODS_USER -R /etc/grid-security

#########################################################
## CERTIFICATES
certdir="/opt/certificates"
mkdir -p $certdir && sudo chown $IRODS_USER /opt/certificates

# Copy current certification authority for other containers
cadir="$certdir/caauth"
if [ ! -d "$cadir" ]; then
    sudo rm -rf $cadir && rsync -avq /etc/grid-security/certificates/ $cadir
    echo "Saved auth for outside containers"
fi

# Add a guest user for GSI certificates
rm -rf /opt/certificates/$GSI_USER \
    && /addusercert $GSI_USER
rm -rf /opt/certificates/$GSI_ADMIN \
    && /addusercert $GSI_ADMIN && iadmin moduser $GSI_ADMIN type rodsadmin

# Fix certificate permissions:
# they have to be owned by the same only user who asks as a client
sudo chown -R $UID:$GROUPS $certdir

{'fraction_non_alphanumeric': 0.1910201912858661, 'fraction_numerical': 0.0005313496280552603, 'mean_word_length': 3.9539473684210527, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '4102326', 'n_tokens_mistral': 1331, 'n_tokens_neox': 1252, 'n_words': 362}