File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,19 @@ function installQuestions() {
185
185
read -n1 -r -p "Press any key to continue..."
186
186
}
187
187
188
+ function installSELinuxRules() {
189
+ local osid
190
+ osid="$1 "
191
+
192
+ if [[ $osid == 'fedora' ]]; then
193
+ dnf install -y checkpolicy
194
+ echo "module se_wg 1 .0 ;require { type wireguard_t; class capability { dac_override dac_read_search }; } allow wireguard_t self:capability { dac_override dac_read_search };" >/tmp/se_wg.te && checkmodule -M -m -o /tmp/se_wg.mod /tmp/se_wg.te && semodule_package -o /tmp/se_wg.pp -m /tmp/se_wg.mod && semodule -i /tmp/se_wg.pp
195
+ elif [[ $osid == 'centos' || $osid == 'almalinux' || $osid == 'rocky' ]]; then
196
+ dnf install -y checkpolicy
197
+ echo "module se_wg 1 .0 ; require {type wireguard_t; type cert_t; type firewalld_t; class capability { dac_override dac_read_search }; class dir search; class dbus send_msg;} allow wireguard_t cert_t:dir search; allow wireguard_t firewalld_t:dbus send_msg; allow wireguard_t self:capability { dac_override dac_read_search };" >/tmp/se_wg.te && checkmodule -M -m -o /tmp/se_wg.mod /tmp/se_wg.te && semodule_package -o /tmp/se_wg.pp -m /tmp/se_wg.mod && semodule -i /tmp/se_wg.pp
198
+ fi
199
+ }
200
+
188
201
function installWireGuard() {
189
202
# Run setup questions first
190
203
installQuestions
@@ -282,6 +295,8 @@ PostDown = ip6tables -t nat -D POSTROUTING -o ${SERVER_PUB_NIC} -j MASQUERADE" >
282
295
echo "net.ipv4 .ip_forward = 1
283
296
net.ipv6 .conf.all.forwarding = 1 " >/etc/sysctl.d/wg.conf
284
297
298
+ installSELinuxRules ${OS}
299
+
285
300
if [[ ${OS} == 'alpine' ]]; then
286
301
sysctl -p /etc/sysctl.d/wg.conf
287
302
rc-update add sysctl
You can’t perform that action at this time.
0 commit comments