Permalink
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
grouper_training/internal/mkstudent.sh
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
84 lines (57 sloc)
2.77 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export GROUPER_GTE_BRANCH=GROUPER_BUILD_CLOUD_FORMATION | |
#export GROUPER_GTE_DOCKER_BRANCH=GROUPER_BUILD_CLOUD_FORMATION | |
export GROUPER_GTE_DOCKER_BRANCH=202503 | |
echo "$GROUPER_GTE_BRANCH" > /root/grouperGteBranch.txt | |
chmod a+r /root/grouperGteBranch.txt | |
echo "$GROUPER_GTE_DOCKER_BRANCH" > /root/grouperGteDockerBranch.txt | |
chmod a+r /root/grouperGteDockerBranch.txt | |
yum -y update | |
yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel wget mlocate emacs nano nslookup mlocate patch gawk jq | |
yum -y install docker | |
#pip3 install docker-compose | |
curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
systemctl start docker | |
docker pull "tier/gte:base-$GROUPER_GTE_DOCKER_BRANCH" | |
docker pull "tier/gte:101.1.1-$GROUPER_GTE_DOCKER_BRANCH" | |
docker pull "tier/gte:201.end-$GROUPER_GTE_DOCKER_BRANCH" | |
docker pull "tier/gte:401.end-$GROUPER_GTE_DOCKER_BRANCH" | |
# Who am i? | |
MY_IP=$(curl icanhazip.com) | |
# Generate a password | |
PASS=$(od -An -N32 -i /dev/random | md5sum | cut -c1-8) | |
#PASS=Gmg86m3ZYalbiaohvaTZ | |
#ENCRYPTED_PASS=$(perl -e 'print crypt($ARGV[0], "password")' $PASS) | |
groupadd -g 1002 student | |
# Make the student account | |
#useradd -u 1002 -g 1002 -m -p $ENCRYPTED_PASS student | |
useradd -u 1002 -g 1002 -m student | |
echo "student:$PASS" | chpasswd | |
# Add the student account to docker group. | |
#usermod -aG docker student | |
# Student uses sudo to become root. | |
usermod -G wheel,docker student | |
echo '%wheel ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/99wheel | |
sed -i "s|PasswordAuthentication no|PasswordAuthentication yes|g" /etc/ssh/sshd_config | |
#sed -i "s|ChallengeResponseAuthentication no|ChallengeResponseAuthentication yes|g" /etc/ssh/sshd_config | |
#sed -i "s|#ChallengeResponseAuthentication no|ChallengeResponseAuthentication yes|g" /etc/ssh/sshd_config | |
systemctl restart sshd.service | |
cd /home/student/ | |
echo >> /home/student/.bashrc | |
echo 'export PATH=/home/student:$PATH' >> /home/student/.bashrc | |
echo >> /home/student/.bashrc | |
wget "https://github.internet2.edu/docker/grouper_training/raw/$GROUPER_GTE_BRANCH/gte" | |
wget "https://github.internet2.edu/docker/grouper_training/raw/$GROUPER_GTE_BRANCH/gte-gsh" | |
wget "https://github.internet2.edu/docker/grouper_training/raw/$GROUPER_GTE_BRANCH/gte-logs" | |
wget "https://github.internet2.edu/docker/grouper_training/raw/$GROUPER_GTE_BRANCH/gte-shell" | |
wget "https://github.internet2.edu/docker/grouper_training/raw/$GROUPER_GTE_BRANCH/README.md" | |
chown student.student /home/student/* | |
chmod +x /home/student/gte | |
chmod +x /home/student/gte-gsh | |
chmod +x /home/student/gte-logs | |
chmod +x /home/student/gte-shell | |
updatedb | |
# Echo the IP and password with no whitespace so it doesnt wrap | |
echo "abcdefg12345678,$MY_IP,$PASS," | |
#pip3 install urllib3==1.26.6 |