Skip to content

Commit

Permalink
Bug fix for RHEL 6/7
Browse files Browse the repository at this point in the history
- Fix compatibility with Red Hat Enterprise Linux (RHEL) 6 and 7
- Ref: hwdsl2#273
  • Loading branch information
hwdsl2 committed Nov 20, 2017
1 parent d472c65 commit 3f39255
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
12 changes: 8 additions & 4 deletions extras/vpnupgrade_centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,22 @@ cd /opt/src || exiterr "Cannot enter /opt/src."
yum -y install wget || exiterr2

# Add the EPEL repository
yum -y install epel-release || exiterr2
epel_url="https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E '%{rhel}').noarch.rpm"
yum -y install epel-release || yum -y install "$epel_url" || exiterr2

# Install necessary packages
yum -y install nss-devel nspr-devel pkgconfig pam-devel \
libcap-ng-devel libselinux-devel curl-devel \
flex bison gcc make fipscheck-devel || exiterr2
flex bison gcc make || exiterr2

OPT1='--enablerepo=*server-optional*'
OPT2='--enablerepo=*releases-optional*'
if grep -qs "release 6" /etc/redhat-release; then
yum -y remove libevent-devel
yum -y install libevent2-devel || exiterr2
yum "$OPT1" "$OPT2" -y install libevent2-devel fipscheck-devel || exiterr2
else
yum -y install libevent-devel systemd-devel || exiterr2
yum -y install systemd-devel || exiterr2
yum "$OPT1" "$OPT2" -y install libevent-devel fipscheck-devel || exiterr2
fi

# Compile and install Libreswan
Expand Down
13 changes: 8 additions & 5 deletions vpnsetup_centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,23 @@ check_ip "$PUBLIC_IP" || exiterr "Cannot detect this server's public IP. Edit th

bigecho "Adding the EPEL repository..."

yum -y install epel-release || exiterr2
epel_url="https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E '%{rhel}').noarch.rpm"
yum -y install epel-release || yum -y install "$epel_url" || exiterr2

bigecho "Installing packages required for the VPN..."

yum -y install nss-devel nspr-devel pkgconfig pam-devel \
libcap-ng-devel libselinux-devel curl-devel \
flex bison gcc make fipscheck-devel \
ppp xl2tpd || exiterr2
flex bison gcc make ppp xl2tpd || exiterr2

OPT1='--enablerepo=*server-optional*'
OPT2='--enablerepo=*releases-optional*'
if grep -qs "release 6" /etc/redhat-release; then
yum -y remove libevent-devel
yum -y install libevent2-devel || exiterr2
yum "$OPT1" "$OPT2" -y install libevent2-devel fipscheck-devel || exiterr2
else
yum -y install libevent-devel systemd-devel iptables-services || exiterr2
yum -y install systemd-devel iptables-services || exiterr2
yum "$OPT1" "$OPT2" -y install libevent-devel fipscheck-devel || exiterr2
fi

bigecho "Installing Fail2Ban to protect SSH..."
Expand Down

0 comments on commit 3f39255

Please sign in to comment.