Skip to content

Commit

Permalink
Merge pull request #6686 from ant-media/fix-enable-ssl-script
Browse files Browse the repository at this point in the history
Fix enable_ssl.sh script warnings in Docker environment
  • Loading branch information
mekya authored Nov 20, 2024
2 parents 74b046c + 9a36e4d commit 2b7dbf2
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/main/server/enable_ssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ usage() {
}

ipt_remove() {
iptab=`iptables -t nat -n -L PREROUTING | grep -E "REDIRECT.*dpt:80.*5080"`
iptab=`iptables -t nat -n -L PREROUTING 2>/dev/null | grep -E "REDIRECT.*dpt:80.*5080"`
if [ "$iptab" ]; then
iptables-save > /tmp/iptables_save
iptables -t nat -D PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 5080
Expand Down Expand Up @@ -104,24 +104,22 @@ get_password() {

install_pkgs() {
if [ -f /etc/debian_version ]; then
sudo apt update -qq
sudo apt install -y jq dnsutils iptables
$SUDO apt update -qq
$SUDO apt install -y jq dnsutils iptables
elif [ -f /etc/redhat-release ]; then
OS_VERSION=$(rpm -E %rhel)
pkgs="jq bind-utils iptables"
if [[ "$OS_VERSION" == "8" ]]; then
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
$SUDO yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
elif [[ "$OS_VERSION" == "9" ]]; then
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
$SUDO yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
else
exit 1
fi
sudo yum install -y $pkgs || sudo dnf install -y $pkgs
$SUDO yum install -y $pkgs || sudo dnf install -y $pkgs
fi
}

install_pkgs

# Check if there is a Container and install necessary packages
is_docker_container() {
if [ -f /.dockerenv ]; then
Expand All @@ -140,6 +138,7 @@ if is_docker_container; then
SUDO=""
fi

install_pkgs

output() {
OUT=$?
Expand Down Expand Up @@ -205,6 +204,8 @@ generate_jwt

get_freedomain(){
hostname="ams-$RANDOM"
#Refactor: It seems that result_marketplace is not used. On the other hand, JWT_KEY is a variable in generate_jwt
#it's better to return JWT_KEY in generate_jwt and don't use any variable other script
result_marketplace=$(generate_jwt)
get_license_key=`cat $INSTALL_DIRECTORY/conf/red5.properties | grep "server.licence_key=*" | cut -d "=" -f 2`
ip=`curl -s http://checkip.amazonaws.com`
Expand Down

0 comments on commit 2b7dbf2

Please sign in to comment.