Commit Graph

24735 Commits

Author SHA1 Message Date
Ermal LUÇI
d97dd42437 Make this code less memory hungry and fix route command generation 2015-01-08 23:58:02 +01:00
Ermal LUÇI
ac8f75f1e0 Catch packets on all iunterfaces and send them out the correct one. Fixes #4174 2015-01-08 22:49:19 +01:00
Phil Davis
bad9dec5e6 Deprecated and non-static method messages
Fix various files that can emit messages like:
PHP Strict Standards:  Non-static method SimplePie_Misc::array_unique()
should not be called statically, assuming $this from incompatible
context in /etc/inc/simplepie/simplepie.inc on line 5508
php-fpm[16262]: /rc.newipsecdns: PHP ERROR: Type: 8192, File:
/etc/inc/shaper.inc, Line: 4365, Message: Assigning the return value of
new by reference is deprecated

Some of these style messages have been reported on the forum, e.g.
https://forum.pfsense.org/index.php?topic=86448.0

I had RSS widget on, and simplepie sent the system beserk telling about
all this stuff.
2015-01-08 14:26:02 -06:00
Renato Botelho
7c1c70d5ea Improve URL and URL ports alias update data:
- Move redundant code to a function parse_aliases_file(). Before the max
number of items was not being respected when URL content is updated,
only when alias was saved. Same was happening with ip/subnet/port
validation and user could end up with a bad pf.conf
- Remove unused variables

These changes were based on Pull Request #1264. It should fix #4189

Submitted by:▸  PiBa-NL
2015-01-08 16:17:03 -02:00
jim-p
1776d19e58 Change OpenVPN CARP VIP test to be more accurate. The client should also not be run if the VIP is in the INIT state. 2015-01-08 10:41:38 -05:00
Renato Botelho
1ba5015467 Unobsolete libcurl.so.4 since it's installed by recent versions of curl package 2015-01-08 12:26:07 -02:00
Renato Botelho
a980b284f3 Fix check for cookies, the way it was implemented didn't work because it would need a refresh to check if cookie was set or not. Use javascript to do a simple test 2015-01-08 11:08:03 -02:00
Renato Botelho
9156a51d0c Add a value to cookie, otherwise it's not set. Before my last change parameters were out of order and expiration time was being set as value. It should fix #4069 2015-01-08 10:26:51 -02:00
Ermal LUÇI
adf8a74a72 This is not the place for this setting and werid its here! 2015-01-08 12:33:54 +01:00
Chris Buechler
f585d06e7f some lagg modes are missing vlanmtu, but work fine with VLANs. Work around it for now at least. Ticket #4186 2015-01-08 00:05:14 -06:00
Chris Buechler
8948f12590 Also include /127 for IPv6, it works fine. Ticket #3657 2015-01-07 23:47:34 -06:00
Chris Buechler
13358d35ae Allow for configuring /31 masks on interfaces.php. The rest of the code was updated accordingly some time ago, and an employee with Cox Communications has confirmed this allows things to work on their circuits deployed with /31s. Ticket #4190 2015-01-07 23:42:10 -06:00
stilez
74017e329f "Like with like" - move a few functions to better places in the code (they are placed strangely)
A few functions such as ipcmp(), subnet_expand(), and check_subnets_overlap()  are in illogical places - away from all the other ip comparison and subnet basic functions and in the middle of alias handling and interface enumeration.

No change to functional code, just moving to earlier in the file (next to other IP compare and subnet functions) for ease of future contributors.
2015-01-07 23:28:58 -06:00
Chris Buechler
05b47f2d31 fix up text 2015-01-07 23:04:34 -06:00
Chris Buechler
6be58d9de8 fix strongswan conf file generation with ipcomp. Ticket #4182 2015-01-07 21:00:08 -06:00
Ermal LUÇI
4a3ce17a7e Fixes #4188 use the same reqid over same phase1 but different phase2 connections. The dashboard will be fixed with the ticket already open. This should fix a lot of instabilities reported on the forums for people having a dozen or more tunnels 2015-01-08 00:48:05 +01:00
Ermal LUÇI
7a9597808c Correct the sense of the check by default unity is enabled 2015-01-07 22:31:02 +01:00
Ermal LUÇI
845f9f7819 Provide an advanced setting to be able to disable Unity Plugin(Cisco extensions) 2015-01-07 22:06:51 +01:00
Ermal LUÇI
1ada4c8c51 Move to specifically specifying the ID type apart when an ip address to have strongswan do proper behaviour. Also for DynDNS names use the dns type id so strongswan does the resolving by its own. 2015-01-07 21:02:31 +01:00
Chris Buechler
2f56ac49ee Don't hard code the target IP in auto-generated outbound NAT rules, use
previous behavior of setting it to the interface IP.
2015-01-07 13:26:18 -06:00
Ermal LUÇI
3c36413133 split is deprecated move to explode 2015-01-07 20:22:16 +01:00
Ermal LUÇI
f3ab0e7468 split is deprecated move to explode 2015-01-07 20:20:35 +01:00
Ermal LUÇI
cc9b3e07ee split is deprecated move to explode 2015-01-07 20:18:50 +01:00
Ermal LUÇI
91456048a7 split is deprecated move to explode 2015-01-07 20:15:57 +01:00
Chris Buechler
2a8a09a9fe fix text 2015-01-07 12:48:47 -06:00
Chris Buechler
d2884b9ae0 fix spelling of compression 2015-01-07 12:47:42 -06:00
Ermal LUÇI
45efe1b672 Fixes #4182 by properly managing IPcomp on ipsec tunnels.
Also retires IPsec force reloading advanced sysctl since its useless nowdays with strongswan and remove its call on rc.newipsecdns.
2015-01-07 16:33:46 +01:00
Renato Botelho
d4e894f6a6 Fix #4146:
OpenVPN create the tun/tap interface and, when set an IP address to
it, mark it as UP. In some scenarios, when TAP is set as bridge and
doesn't have an IP address set on it, it never goes up and tunnel
doesn't work.

If rc.newwanip is called for this TAP interface, UP flag is set, but,
rc.newwanip is not executed when system is booting.

Since it's always rename the interface and add it the group, make sure
it's up here.
2015-01-07 09:11:58 -02:00
Chris Buechler
19c8976b12 Log PHP errors. Ticket #4143 2015-01-07 00:47:50 -06:00
Ermal LUÇI
9b182b0801 Enforce subnet check here to avoid any issues resulting from function call. 2015-01-06 22:54:37 +01:00
Renato Botelho
c8d87d2aa9 Remove useless check, CARP does not depend of interface having another IP set before 2015-01-06 18:55:00 -02:00
Renato Botelho
3ffea31990 Remove some extra spaces 2015-01-06 15:17:13 -02:00
Renato Botelho
d9db486205 Fix typo on variable name 2015-01-06 15:17:13 -02:00
stilez
374b2f211b Tighten and IPv6-ify gen_subnet() etc
Tightens, canonicalises and improves for IPv6, the functions
gen_subnet(), gen_subnetv6(), gen_subnet_max(), gen_subnetv6_max()

Changes are transparent to calling code.

Issues:

1) gen_subnet() and gen_subnet_max() will validate both IPv4 and IPv6 as valid args, but will then try to process an IPv6 subnet bitwise as x32 LONG without further checking, causing erroneous but apparently valid responses.

2) None of the functions properly sanitise their input: if $bits is >32 or >128, or even a non-integer, erroneous results will be passed back to the calling code as valid data without checking, again causing erroneous but apparently valid responses.

3) 3 of the 4 functions return an empty string for invalid but gen_subnetv6_max() returns a numeric value for invalid. Both responses loose-evaluate as False, but consistency is better.

Fixes and improvements:

1) The unspecified functions gen_subnet() and gen_subnet_max() now handle all args correctly, and don't mishandle if unexpectedly passed IPv6 or bad data.

2) Names are now canonical: gen_subnet(), gen_subnet_max() are now IPv4/v6 agnostic, and IPv4-only versions gen_subnetv4() and gen_subnetv4_max() are added as expected to exist, to match existing functions gen_subnetv6() and gen_subnetv6_max().

3) The return value for bad args is made consistent (empty string = False).

4) gen_subnetv6_max() now uses Net_IPv6's Ip2Bin() and Bin2Ip() functions and simple string manipulation rather than bitwise operations, so it's guaranteed 32-bit safe (compared to 128-bit bitwise operations in current code which seem less certain?)

5) Changes are transparent - the canonical functions still work exactly as before on IPv4 (only with proper bad arg validation) but also now work on IPv6 transparently, and on arbitrary IPv4/IPv6 data, similar to other functions like is_ipaddr().

Tested and handles valid but uncommon edge cases of /0, /32 (IPv4) and /128 (IPv6) correctly. Also avoids inet_ntop/pton if that's a real issue (previous PR comment had asked to avoid these functions)
2015-01-06 15:17:12 -02:00
Phil Davis
0bd024d0b1 OpenVPN backend authentication fix key and translation
The array returned by auth_get_authserver_list() has key as the fixed name of each available authentication mode - e.g. "Local Database".
The array value ["name"] has the name string translated into the selected GUI language.
Use the key do determine which items are selected, and as the value that ends up being stored in the config.
Use ["name"] for display.
Forum report: https://forum.pfsense.org/index.php?topic=86326.0
Redmine Bug #4180
2015-01-06 12:22:45 -02:00
Renato Botelho
d854065997 Revert "FreeBSD fails to set advskew back to 0 after you set it to any other"
A patch was added to allow set advskew back to 0

This reverts commit eea2ad5d61.
2015-01-06 11:44:55 -02:00
Renato Botelho
b785a40bac Add secure flag when necessary to cookie_test, as we do for session cookie, to avoid false positives in common vulnerabilities scanners. It fixes #4069 2015-01-06 10:01:00 -02:00
Phil Davis
055bd1ee0c Allow IPv6 on loopback needs quick
The following block uses "quick" which causes that block to come into effect before the "pass in" here. The pass rule also needs to be "quick".
Problem noted by Andy Sayler on https://redmine.pfsense.org/issues/4074
Before this change, an attempt to manually do something local with IPv6 fails:
[2.2-RC][root@xxx]/root: ntpq -pn
ntpq: write to localhost failed: Operation not permitted
After this change, it works:
[2.2-RC][root@xxx]/root: ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*27.114.150.12   193.190.230.65   2 u   21   64  377  1424.66  -126.52 371.131

Note that there are other pass rules later for IPv6 necessary functions, loopback... that do not have "quick". Those are correct and help to allow various essential IPv6 stuff, but still let someone block it with user rules (which will have quick), in the case when IPv6 Allow is checked.
This one here is just for the special case of IPv6 Allow not set, and in this case this special IPv6 pass-block sequence needs to be done with "quick" so we can be sure it applies regardless of whatever other IPv6 might come later.
2015-01-05 12:57:38 -06:00
Phil Davis
91a84a26c8 Limit unbound so-rcvbuf: 8m
Issue reported here: https://forum.pfsense.org/index.php?topic=78356.msg472781#msg472781
Most unbound doc places mention setting it at up to 8m. I'm sure it would be possible to investigate more and find a way to make unbound+FreeBSD be able to go higher than 8m. But probably 8m is sufficient for everyone anyway (judging by what the unbound docs seem to assume will be a good value on a busy system).
Anyway, here is my easy fix for this. Someone else feel free to investigate more if they really need to set so-rcvbuf higher.
2015-01-05 12:56:42 -06:00
Renato Botelho
0a23cddced Fix #4090:
- Unbound advanced options may contain double quotes and it breaks the
syntax when a backup is restored because newlines are trimmed. Save it
in base64 format is a safe way to prevent it
- Bump config version to 11.5
- Provide upgrade code to encode current config or the one that came
from unbound package on 2.1.5
2015-01-05 15:41:38 -02:00
Renato Botelho
24149c3176 It's supposed to remove windows EOL here, not ; 2015-01-05 12:58:30 -02:00
Renato Botelho
7f5c266994 Make it possible to backup/restore 'DNS Resolver' section individually 2015-01-05 12:58:28 -02:00
Phil Davis
62403377e1 Do not monitor a gateway that has not got DHCP yet
When an interface is waiting to get DHCP, but the cable is physically-electrically connected to the upstream device, the interface has an IPv4 address 0.0.0.0 - that was getting past here and, if the interface gateway had a monitor IP specified, that monitor IP was being put into apinger.conf and being monitored. Because the interface has not got a gateway yet, no static route is added to force the traffic for the monitor IP out the particular interface. So the traffic to the monitor IP can follow the default route and perhaps succeed in getting out another WAN to the monitor IP.
The downstream results of this were:
1) Gateway status appears up and reports real RTT and Loss statistics, even though the interface is down.
2) Generation of rules for a gateway group that has this gateway as tier1 will think it is up, and thus try to policy-route traffic to it - which then does not get anywhere.
3) DynDNS status of a gateway group that has this gateway as tier1 shows the cached IP in red - it thinks the interface/gateway is up and tries to find the public IP by trying to get to checkip.dyndns.com through the interface/gateway. That of course fails.
4) I'm sure there are other things that depend on checking gateway and gateway group status that would also be getting it wrong in this condition, because apinger is being told to monitor, and manages to successfully monitor, an interface/gateway that has not yet got DHCP.

When waiting for DHCP, ifconfig shows like this on my system (WAN is on a cable to a VLAN switch):
vr0_vlan70: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:0d:b9:24:59:c0
        inet6 fe80::20d:b9ff:fe24:59c0%vr0_vlan70 prefixlen 64 scopeid 0xf
        inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        vlan: 70 vlanpcp: 0 parent interface: vr0

From what I can see, this little 2-line fix ends up correcting all the downstream effects I listed above.
Should fix RedMine #4094
2015-01-05 11:17:27 -02:00
Renato Botelho
5a158a2969 Fix track6 prefix id range check, reported by jimp 2015-01-02 13:07:15 -02:00
Phil Davis
8c46314c6b Allow blank source port in diag_testport
Reported by forum https://forum.pfsense.org/index.php?topic=86146.0
Also, if there are input validation errors, save the user-entered data and re-display it, making it easier for the user to just correct the data in error and press Test again. It was blanking out all the entered data.
2015-01-02 09:25:06 -02:00
Phil Davis
6317d31dfc Fix lineup of copyright lines
and module names and other bits of formatting and typos in header
comment sections.
2015-01-01 10:13:14 -02:00
Phil Davis
d4b2cd35b9 Remove duplicate copyright
Noticed these had the copyright twice
2015-01-01 10:13:14 -02:00
Chris Buechler
1d709219ed Use binat, not nat, where IPsec NAT is configured with an address for local and NAT. Ticket #4169 2014-12-31 16:18:50 -06:00
Renato Botelho
d961e7e33e Welcome 2015 2014-12-31 16:22:27 -02:00
Renato Botelho
16a0f33446 Add config upgrade code to make sure iketype is set, bump config version to 11.4. It fixes #4163 2014-12-31 12:54:34 -02:00