Commit Graph

24716 Commits

Author SHA1 Message Date
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
Renato Botelho
7cb2ebe755 libreadline.so.6 is not supposed to be obsoleted, fixes #4159 2014-12-31 12:26:49 -02:00
Chris Buechler
3cf56fb072 Allow IPv6 on loopback even where IPv6 is otherwise disabled. The intent of that feature is to prevent IPv6 from communicating on the network. Blocking it on localhost can result in issues and is unnecessary. Ticket #4074 2014-12-31 02:02:05 -06:00
Chris Buechler
1c84a5f10c Reload Unbound after IP changes, to fix issues noted in Ticket #4095. Do so before Dynamic DNS updates occur to ensure the host has functioning DNS. 2014-12-30 23:10:44 -06:00
Phil Davis
1142d9a06b IPsec Widget allow for old settings that have no iketype
as mentioned in https://forum.pfsense.org/index.php?topic=84527.msg471919#msg471919
This change makes it work like similar if tests in /usr/local/wwwvpn_ipsec.php, and code in /etc/inc/vpn.inc that effectively defaults to ikev1 when iketype is not specified.
This should make the code here be executed and make $ikeid get the correct value to be used in later code.
2014-12-30 20:43:24 -06:00
Phil Davis
6e26b9c554 Allow for old settings that have no iketype
This bit of code looks like it could do with the same test as https://github.com/pfsense/pfsense/pull/1412
This is executed when the "Connect" button is pressed from Status->IPsec
Somebody with these problematic old IPsec entries could test this - with current code I suspect that disconnect followed by connect - it will not connect. With this change it will (might?) connect again.
2014-12-30 20:40:46 -06:00
Chris Buechler
c8c4520ae2 Only set route-to and reply-to on ESP and ISAKMP rules if the remote endpoint is not within the parent interface's subnet. Ticket #4157 2014-12-30 20:12:19 -06:00
Ermal
430f8380ba Check for fqdn peerid/myids and prepend @ so strongswan does not try to be smart. Also use %any for myid instead of risking of putting the wrong value in the secrets file for traffic selector 2014-12-30 23:22:30 +00:00
Ermal LUÇI
f3106b3f4a Check for fqdn peerid/myids and prepend @ so strongswan does not try to be smart. Also use %any for myid instead of risking of putting the wrong value in the secrets file for traffic selector 2014-12-30 23:21:34 +00:00
Ermal
1e7d24824f Oops this should be 0s rather than 00. Linked with Ticket #4158 2014-12-30 23:17:16 +00:00
Phil Davis
68f0da5990 ipsec_smp_dump_status get out of loop if error
when reading response from socket.
Otherwise it would be in a loop and end up like: https://forum.pfsense.org/index.php?topic=86039.msg471848#msg471848
PHP Fatal error:  Maximum execution time of 900 seconds exceeded in /etc/inc/ipsec.inc on line 383

This code runs on my system, but I do not know how to induce the possible loop condition to actually test if it would really break out and return nicely.
2014-12-30 23:14:45 +00:00
Ermal LUÇI
83650c94af Unbreak IPsec rules generation for IPsec over CARP. Should help even Ticket #4157 2014-12-30 23:52:31 +01:00
Ermal LUÇI
c86c2b8b7d Use base64 encoded secrets which Fixes #4158 2014-12-30 22:45:52 +01:00
Phil Davis
13c6375b6e Captive portal spelling 2014-12-30 09:47:45 -02:00
Phil Davis
ef0d25b36a Standardise text in priv list 2014-12-30 09:47:45 -02:00
Phil Davis
55f910a3de Simplify cron array comparison
This works fine - I had not thought about how arrays are compared. Using "==" checks that the key/value pairs match in both arrays, regardless of the order the arrays happen to be in, which is what we want here.
Using "===" would insist that the key/value pairs are also in the same order in the array and that the types and everything match identically, which we do not require.
2014-12-29 12:48:03 -02:00
Phil Davis
71bd5ec115 Minimise config updates when checking cron jobs 2014-12-29 12:48:03 -02:00
Colin Fleming
91145658f0 Backout pull request #1391
https://forum.pfsense.org/index.php?topic=85944.0

Backout pull request #13191
2014-12-29 11:40:55 -02:00
Phil Davis
8f6875de03 Fix unbound shortcut links
Fixes redmine #4151
1) Make the naming in shortcuts.inc more clear - forwarder=dnsmasq
resolver=unbound
2) Make the value of $shortcuts_section correct in each dnsmasq and
unbound php code
3) Make diag_logs_resolver.php smarter, so if dnsmasq is enabled, then
show shortcuts for dnsmasq, otherwise show shortcuts for unbound.
4) Fix some references to forwarder in unbound code - should be
resolver.
2014-12-28 13:45:15 -05:00
Chris Buechler
e63734ff1d clarify message here after customer feedback, it wasn't meant to imply "only a reboot will re-enable" but that's how some people have read it. 2014-12-26 16:50:26 -06:00