Deploying GreenRadius on Amazon Linux 2023
Prerequisites
- A target machine (
x86_64
) running Amazon Linux 2023 - A GreenRADIUS update package (v5.1.6.6 or later)
- If you have installed firewall software, make sure that it is set up properly to allow incoming connections.
- SELinux set to "permissive" or "disabled" (this is the default on fresh installations)
- The
docker-compose-override-tz.yml
,docker-compose-override.yml
, andtimezone_handle_for_docker_on_Amazon-Linux-2.sh
files from this deployment package
Deployment Instructions
- Log in with a user that has sudo access.
- Run
sudo yum update
- Run
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
- Run
sudo yum -y install wget unzip awscli aws-cfn-bootstrap nfs-utils chrony conntrack jq ec2-instance-connect socat
- Run
sudo yum install curl
- Run
sudo yum install libxcrypt-compat
- Run
if sudo yum list installed | grep ec2-net-utils; then sudo yum remove ec2-net-utils -y -q; fi
- Run
sudo yum -y install docker
- Run
sudo systemctl enable docker
- Run `sudo curl -L "https://github.com/docker/compose/releases/download/1.28.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- Run
sudo chmod +x /usr/local/bin/docker-compose
- Run
sudo yum install unzip
- Run
wget https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/i/incron-0.5.12-12.el8.x86_64.rpm
- Run
sudo rpm -i incron-0.5.12-12.el8.x86_64.rpm
- Run
sudo yum install net-tools
- Run
sudo useradd -d /home/gradmin -m -G wheel -s /bin/bash gradmin
- Run
sudo passwd gradmin
- Run
chmod -R 750 /home/gradmin
- Run
chown -R gradmin:gradmin /home/gradmin
- Run
sudo su gradmin
to assume the permissions of the gradmin user - Run
mkdir ~/temp
- Run
cd ~/temp
- Copy the latest GreenRADIUS update package to the
/home/gradmin/temp/
directory. - Copy the provided
docker-compose.override-tz.yml
file to the/home/gradmin/temp/
directory. - Copy the provided
docker-compose.override.yml
file to the/home/gradmin/temp/
directory. - Copy the provided
timezone_handle_for_docker_on_Amazon-Linux-2.sh
script to/home/gradmin
directory. - Run
sudo chmod 750 /home/gradmin/timezone_handle_for_docker_on_Amazon-Linux-2.sh
- Run
sudo chown gradmin:gradmin /home/gradmin/timezone_handle_for_docker_on_Amazon-Linux-2.sh
- Run
sudo service docker start
- Run
sudo unzip GreenRADIUS_xxxx_Update.zip
. In this instruction and those following, replacexxxx
with the version number for the upgrade package. - Run
sudo tar -xvzf GreenRADIUS_xxxx_Update/images.tgz -C .
- Run
sudo tar -xvzf GreenRADIUS_xxxx_Update/others.tgz -C .
- Run
sudo mkdir -p /opt/grs/scripts
- Run
sudo cp others/vm_incron_scripts/* /opt/grs/scripts/
- Run
cd /opt/grs/scripts && sudo chown root:root *.sh && sudo chmod 511 freeradius_restart.sh get_host_info.sh incron_script.sh openldap_cmd_template_3.sh openldap_restart.sh openldap_update_ca_certificates.sh rsyslog_restart.sh && cd -
- Run
sudo bash -c "echo 'gradmin ALL=(root) NOPASSWD:/opt/grs/scripts/get_host_info.sh , /opt/grs/scripts/incron_script.sh , /opt/grs/scripts/rsyslog_restart.sh , /opt/grs/scripts/freeradius_restart.sh , /opt/grs/scripts/openldap_restart.sh , /opt/grs/scripts/openldap_update_ca_certificates.sh , /opt/grs/scripts/openldap_cmd_template_3.sh' > /etc/sudoers.d/grs"
- Run
sudo mkdir -p /opt/grs/host-comm/request
- Run
sudo mkdir -p /opt/grs/host-comm/response
- Run
sudo chown -R gradmin:gradmin /opt/grs/host-comm
- Run
sudo bash -c "echo 'gradmin' > /etc/incron.allow"
- Run
sudo bash -c "echo '/opt/grs/host-comm/request IN_CLOSE_WRITE sudo /opt/grs/scripts/incron_script.sh \$#' > /var/spool/incron/gradmin"
- Run
sudo systemctl enable incrond
- Run
sudo service incrond restart
- Run
sudo docker load -i images/greenradius_xxxx_init_image
- Run
sudo docker load -i images/greenradius_xxxx_main_image
- Run
sudo docker load -i images/greenradius_xxxx_openldap_image
- Run
sudo docker load -i images/greenradius_xxxx_postgres_image
- Run
sudo docker load -i images/greenradius_xxxx_rsyslog_image
- Run
sudo docker load -i images/greenradius_xxxx_freeradius_image
- Run
sudo docker load -i images/greenradius_xxxx_grs_auth_app_image
- Run
sudo mkdir -p /home/gradmin/grs-docker-compose
- Run
sudo cp others/docker-compose.yml /home/gradmin/grs-docker-compose/
- Run
sudo chmod 750 /home/gradmin/grs-docker-compose/docker-compose.yml
- Run
sudo chown gradmin:gradmin /home/gradmin/grs-docker-compose/docker- compose.yml
- Run
sudo cp docker-compose.override-tz.yml /home/gradmin/grs-docker-compose/
- Run
sudo chmod 750 /home/gradmin/grs-docker-compose/docker-compose.override-tz.yml
- Run
sudo chown gradmin:gradmin /home/gradmin/grs-docker-compose/docker-compose.override-tz.yml
- Run
sudo cp docker-compose.override.yml /home/gradmin/grs-docker-compose/
- Run
sudo chmod 750 /home/gradmin/grs-docker-compose/docker-compose.override.yml
- Run
sudo chown gradmin:gradmin /home/gradmin/grs-docker-compose/docker-compose.override.yml
- Set the proper timezone using the command
sudo timedatectl set-timezone <time zone>
. You can view a list of valid timezones withsudo timedatectl list-timezones | less
. - Run
file /etc/timezone
- If and only if
/etc/timezone
exists and is a directory, runsudo rm -rf /etc/timezone
- Run
sudo touch /etc/timezone
- Edit
/etc/timezone
and enter the value set in step 59. - Run
sudo sh /home/gradmin/timezone_handle_for_docker_on_Amazon-Linux-2.sh
- Run
sudo su -
- Run
cd /home/gradmin/grs-docker-compose
- Run
docker-compose -f docker-compose.yml -f docker-compose.override.yml -f docker- compose.override-tz.yml up -d
- Run
sudo touch /etc/systemd/system/grs-docker-compose-app.service
- Edit
/etc/systemd/system/grs-docker-compose-app.service
and enter the following:# /etc/systemd/system/grs-docker-compose-app.service [Unit] Description=Docker Compose Application Service Requires=docker.service After=docker.service [Service] Type=oneshot RemainAfterExit=yes WorkingDirectory=/home/gradmin/grs-docker-compose ExecStart=/usr/local/bin/docker-compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.override-tz.yml up -d ExecStop=/usr/local/bin/docker-compose down TimeoutStartSec=0 [Install] WantedBy=multi-user.target
- Save the file.
- Run
sudo systemctl enable grs-docker-compose-app
- Run
sudo systemctl start grs-docker-compose-app.service
- Run
sudo rm -rf /home/gradmin/temp/*
To apply subsequent updates
- Copy the update package to the
/home/gradmin/temp/
directory. - Log in as
gradmin
. - Run
sudo yum update
- Run
sudo unzip /home/gradmin/temp/GreenRADIUS_xxxx_Update.zip -d /home/gradmin/temp/
. Note that in this command and below,xxxx
should be replaced with the current version number. - Run
cd /home/gradmin/temp
- Run
sudo tar -xvzf GreenRADIUS_xxxx_Update/images.tgz -C .
- Run
sudo tar -xvzf GreenRADIUS_xxxx_Update/others.tgz -C .
- Run
sudo docker load -i images/greenradius_xxxx_init_image
- Run
sudo docker load -i images/greenradius_xxxx_main_image
- Run
sudo docker load -i images/greenradius_xxxx_openldap_image
- Run
sudo docker load -i images/greenradius_xxxx_postgres_image
- Run
sudo docker load -i images/greenradius_xxxx_rsyslog_image
- Run
sudo docker load -i images/greenradius_xxxx_freeradius_image
- Run
sudo docker load -i images/greenradius_xxxx_grs_auth_app_image
- Run
cd /home/gradmin/grs-docker-compose
- Run
sudo docker-compose down
- Run
sudo cp /home/gradmin/temp/others/docker-compose.yml /home/gradmin/grs-docker-compose/
- Run
cd /home/gradmin/grs-docker-compose
- Run
sudo docker-compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.override-tz.yml up -d
- Run
sudo rm -rf /home/gradmin/temp/*
To manually start/stop containers
First, change the directory with cd /home/gradmin/grs-docker-compose/
.
To start the container, run sudo docker-compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.override-tz.yml up -d
.
To stop the container, run sudo docker-compose down
.
Updated 2023-10-31
© 2024 Green Rocket Security Inc. All rights reserved.
© 2024 Green Rocket Security Inc. All rights reserved.