Skip to content

Commit 49679a8

Browse files
committed
A cleanup
1 parent 92f793f commit 49679a8

File tree

2 files changed

+81
-47
lines changed

2 files changed

+81
-47
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<p align="center" >
2-
<img src="https://raw.github.com/E-F-A/v3/master/build/EFA/EFAlogo-79px.png" alt="EFA" title="EFA">
2+
<img src="https://raw.github.com/E-F-A/v3/master/build/EFA/EFAlogo-79px.png" alt="eFa" title="eFa">
33
</p>
44

55

6-
E.F.A stands for Email Filter Appliance.
7-
E.F.A is born out of a need for a cost-effective email virus & spam scanning solution after the ESVA project died.
6+
eFa stands for Email Filter Appliance.
7+
eFa is born out of a need for a cost-effective email virus & spam scanning solution after the ESVA project died.
88

99
We try to create a complete package using existing open-source anti-spam projects and combine them to a single easy to use (virtual) appliance.
1010

1111
For more information go to https://efa-project.org
1212

13-
E.F.A V4 is a rebuild of the previous ESVA; the same components are used whenever possible but are all updated to the latest version.
13+
eFa V4 is a rebuild of the previous ESVA; the same components are used whenever possible but are all updated to the latest version.

build/build.bash

+77-43
Original file line numberDiff line numberDiff line change
@@ -69,27 +69,26 @@ function main() {
6969
# Pre-build
7070
#-----------------------------------------------------------------------------#
7171
function prebuild () {
72-
# mounting /tmp without nosuid and noexec while building
73-
# as it breaks building some components.
74-
mount -o remount rw /tmp
72+
# mounting /tmp without nosuid and noexec while building
73+
# as it breaks building some components.
74+
mount -o remount rw /tmp
7575
}
7676
#-----------------------------------------------------------------------------#
7777

7878
#-----------------------------------------------------------------------------#
79-
# add eFa Repo (Debian packages)
79+
# add eFa Repo (CentOS packages)
8080
#-----------------------------------------------------------------------------#
8181
function efarepo () {
8282
# TODO
83-
echo "todo"
83+
echo "todo"
8484
}
8585
#-----------------------------------------------------------------------------#
8686

8787
#-----------------------------------------------------------------------------#
8888
# Update system before we start
8989
#-----------------------------------------------------------------------------#
90-
function upgrade_os () {
91-
apt-get update
92-
apt-get -y upgrade
90+
function update_os () {
91+
yum -y update
9392
}
9493
#-----------------------------------------------------------------------------#
9594

@@ -98,67 +97,102 @@ function upgrade_os () {
9897
#-----------------------------------------------------------------------------#
9998
function check_network () {
10099
# TODO
101-
echo "Check if network is functioning correctly before we start"
100+
echo "Check if network is functioning correctly before we start"
101+
}
102+
#-----------------------------------------------------------------------------#
103+
104+
#-----------------------------------------------------------------------------#
105+
# Configure firewall
106+
#-----------------------------------------------------------------------------#
107+
function configure_firewall () {
108+
local methode="$1"
109+
if [[ "$methode" == "full" ]]; then
110+
firewall-cmd --permanent --add-service=smtp
111+
firewall-cmd --permanent --add-service=ssh
112+
firewall-cmd --permanent --add-port 80/tcp
113+
firewall-cmd --permanent --add-port 443/tcp
114+
firewall-cmd --reload
115+
elif [[ "$methode" == "frontend" ]]; then
116+
firewall-cmd --permanent --add-service=smtp
117+
firewall-cmd --permanent --add-service=ssh
118+
firewall-cmd --reload
119+
elif [[ "$methode" == "backend" ]]; then
120+
firewall-cmd --permanent --add-service=ssh
121+
firewall-cmd --permanent --add-port 80/tcp
122+
firewall-cmd --permanent --add-port 443/tcp
123+
firewall-cmd --reload
124+
fi
102125
}
103126
#-----------------------------------------------------------------------------#
104127

105128
#-----------------------------------------------------------------------------#
106129
# Full install setup, front & backend
107130
#-----------------------------------------------------------------------------#
108131
function full_install() {
109-
echo "Full install"
110-
check_network
111-
prebuild
132+
echo "Full install"
133+
check_network
134+
prebuild
135+
configure_firewall full
112136
}
113137
#-----------------------------------------------------------------------------#
114138

115139
#-----------------------------------------------------------------------------#
116-
# Frontend setup, just mail handling
140+
# Frontend setup, mail handling
117141
#-----------------------------------------------------------------------------#
118142
function frontend_install() {
119-
echo "frontend install"
120-
check_network
121-
prebuild
143+
echo "frontend install"
144+
prebuild
145+
check_network
146+
configure_firewall frontend
122147
}
123148
#-----------------------------------------------------------------------------#
124149

125150
#-----------------------------------------------------------------------------#
126-
# Backend setup, just mail handling
151+
# Backend setup, config & viewing
127152
#-----------------------------------------------------------------------------#
128153
function backend_install() {
129-
echo "Backend install"
130-
check_network
131-
prebuild
154+
echo "Backend install"
155+
prebuild
156+
check_network
157+
configure_firewall backend
132158
}
133159
#-----------------------------------------------------------------------------#
134160

135161
#-----------------------------------------------------------------------------#
136162
# Prepare OS if the system has not been installed from kickstart
137163
#-----------------------------------------------------------------------------#
138164
function prepare_os() {
139-
echo "Starting Prepare OS"
140-
#-------------------------------------------------------------------------#
141-
OSVERSION=`cat /etc/centos-release`
142-
if ! [[ "$OSVERSION" == "CentOS Linux release 7.3.1611 (Core)" ]]; then
143-
echo "ERROR: You are not running CentOS 7"
144-
echo "ERROR: Unsupported system, stopping now"
145-
exit 1
146-
fi
147-
# Check network connectivity
148-
check_network
149-
150-
# Upgrade the OS before we start
151-
upgrade_os
152-
153-
# Create base dirs
154-
mkdir /var/log/eFa
155-
mkdir /usr/src/eFa
156-
# Change the root password
157-
echo "root:EfaPr0j3ct" | chpasswd --md5 root
158-
#-------------------------------------------------------------------------#
159-
echo "Prepare is finished, you can now run the script again and select"
160-
echo "one of the installation options to build the system."
165+
echo "Starting Prepare OS"
166+
#---------------------------------------------------------------------------#
167+
OSVERSION=`cat /etc/centos-release`
168+
if [[ $OSVERSION =~ .*'release 7.'.* ]]; then
169+
echo "Good you are running CentOS 7"
170+
else
171+
echo "ERROR: You are not running CentOS 7"
172+
echo "ERROR: Unsupported system, stopping now"
161173
exit 1
174+
fi
175+
176+
# Check network connectivity
177+
check_network
178+
179+
# Upgrade the OS before we start
180+
update_os
181+
182+
# Create base dirs
183+
mkdir /var/log/eFa
184+
mkdir /usr/src/eFa
185+
186+
# Change the root password
187+
echo "root:EfaPr0j3ct" | chpasswd --md5 root
188+
189+
# Add efa Repo
190+
# TODO
191+
192+
#---------------------------------------------------------------------------#
193+
echo "Prepare is finished, you can now run the script again and select"
194+
echo "one of the installation options to build the system."
195+
exit 1
162196
}
163197
#-----------------------------------------------------------------------------#
164198

@@ -168,7 +202,7 @@ function prepare_os() {
168202
if [ `whoami` == root ]; then
169203
main
170204
else
171-
echo "Please become root first."
205+
echo "ERROR: Please become root first."
172206
exit 1
173207
fi
174208
#-----------------------------------------------------------------------------#

0 commit comments

Comments
 (0)