Skip to content

Commit

Permalink
Fix php-curl installation
Browse files Browse the repository at this point in the history
Fix Enable/DisableNotifier()
Fix dhcpd Start()
Add fcm pf rules for internal mobile devices, as commented out
  • Loading branch information
sonertari committed Sep 16, 2018
1 parent c6470da commit 3718fab
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
6 changes: 6 additions & 0 deletions config/etc/pf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ int_net = "192.168.1.0/24"
# MSN, ICQ/AIM, Yahoo, IRC
im_ports = "{ 1863, 5190, 5050, 6667 }"

# FCM ports for Firebase push notifications
fcm_ports = "{ 5228, 5229, 5230 }"

openvpn = "{ tun0, tun1 }"

table <RestrictedIPs> persist file "/etc/pf.restrictedips"
Expand Down Expand Up @@ -87,6 +90,9 @@ pass out log on $int_if proto tcp from $int_if to port ssh
# UTMFW Web Administration Interface
pass in log on $int_if proto tcp from $int_net to $int_if port { www, https }

# Firebase push notifications for internal mobile devices
#pass in log on $int_if proto tcp from $int_net to port $fcm_ports

# DNS queries to UTMFW
pass in log on $int_if proto { tcp, udp } from $int_net to $int_if port { domain, bootps }

Expand Down
2 changes: 1 addition & 1 deletion config/utmfw.files
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ etc/p3scan/p3scan-tr-utf8.mail,644,root,wheel
etc/p3scan/p3scan-nl.mail,644,root,wheel
etc/p3scan/p3scan.conf,644,root,wheel
etc/pfre/pf.conf.afterhours,600,root,wheel
etc/php-7.0/cul.ini,644,root,bin
etc/php-7.0/curl.ini,644,root,bin
etc/php-7.0/mcrypt.ini,644,root,bin
etc/php-7.0/pcntl.ini,644,root,bin
etc/pmacct/pmacctd-pnrg.conf,644,root,wheel
Expand Down
1 change: 1 addition & 0 deletions meta/install.sub
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ __EOT
pkg_add php-pcntl
pkg_add php-mcrypt
pkg_add php-cgi
pkg_add php-curl
;;
esac
;;
Expand Down
10 changes: 9 additions & 1 deletion src/Model/dhcpd.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,18 @@ function __construct()
*/
function Start()
{
global $TmpFile;

if (($ifs= $this->_getIfs()) !== FALSE) {
$ifs= explode("\n", $ifs);
$ifs= implode(' ', $ifs);
return $this->RunShellCommand("/usr/sbin/dhcpd $ifs");
$this->RunShellCommand("/usr/sbin/dhcpd $ifs > $TmpFile 2>&1");

/// Start command is redirected to tmp file
$output= file_get_contents($TmpFile);
Error($output);
ctlr_syslog(LOG_INFO, __FILE__, __FUNCTION__, __LINE__, "Start output: $output");
return $this->IsRunning();
}
return FALSE;
}
Expand Down
6 changes: 4 additions & 2 deletions src/Model/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,8 @@ function IsNotifierEnabled()
function DisableNotifier()
{
$tmp= $this->cronDir.'root';
$this->PutFile($tmp, $this->getRootCronTab());
// Do not use PutFile(), it expects file to exist
file_put_contents($tmp, $this->getRootCronTab(), LOCK_EX);

$retval= $this->ReplaceRegexp($tmp, "?^(\h*\*/1\h+\*\h+\*\h+\*\h+\*\h+/usr/local/bin/php\h+/var/www/htdocs/utmfw/Notifier/notify.php\h+.*)$?m", '#${1}');
if (file_exists($tmp.'.bak')) {
Expand All @@ -1324,7 +1325,8 @@ function DisableNotifier()
function EnableNotifier()
{
$tmp= $this->cronDir.'root';
$this->PutFile($tmp, $this->getRootCronTab());
// Do not use PutFile(), it expects file to exist
file_put_contents($tmp, $this->getRootCronTab(), LOCK_EX);

$retval= $this->ReplaceRegexp($tmp, "?^\h*#(\h*\*/1\h+\*\h+\*\h+\*\h+\*\h+/usr/local/bin/php\h+/var/www/htdocs/utmfw/Notifier/notify.php\h+.*$)?m", '${1}');
if (file_exists($tmp.'.bak')) {
Expand Down

0 comments on commit 3718fab

Please sign in to comment.