The filter rules preventing websites from portscanning the local machine have recently been tightened in Brave. It turns out there are a surprising number of ways to refer to the local machine in Chromium.
localhost
and friends
127.0.0.1
is the first address that comes to mind when thinking of the
local machine. localhost
is typically aliased to that address (via
/etc/hosts
), though that convention is not mandatory. The IPv6 equivalent
is [::1]
.
- http://localhost/
- http://foo.localhost/
- http://127.0.0.1/
- http://0177.0000.0000.0001/ (
127.0.0.1
in octal) - http://0x7F000001/ (
127.0.0.1
in hex) - http://2130706433/ (
127.0.0.1
in decimal) - http://[::ffff:127.0.0.1]/ (IPv4-mapped IPv6 address)
- http://[::ffff:7f00:1]/ (alternate of IPv4-mapped IPv6 address)
- http://[0000:0000:0000:0000:0000:ffff:7f00:0001]/ (fully-expanded IPv4-mapped IPv6 address)
- http://[::1]/
- http://[0000:0000:0000:0000:0000:0000:0000:0001]/ (fully-expanded form of
[::1]
)
0.0.0.0
0.0.0.0
is not a routable address, but that's what's used to tell a
service to bind (listen) on all network interfaces. In Chromium, it resolves
to the local machine, just like 127.0.0.1
. The IPv6 equivalent is [::]
.
- http://0.0.0.0/
- http://0000.0000.0000.0000/ (
0.0.0.0
in octal) - http://0x00000000/(
0.0.0.0
in hex) - http://0/ (
0.0.0.0
in decimal) - http://[::ffff:0.0.0.0]/ (IPv4-mapped IPv6 address)
- http://[::ffff:0000:0000]/ (alternate form of IPv4-mapped IPv6 address)
- http://[0000:0000:0000:0000:0000:ffff:0000:0000]/ (fully-expanded IPv4-mapped IPv6 address)
- http://[::]/
- http://[0000:0000:0000:0000:0000:0000:0000:0000]/ (fully-expanded form of
[::]
)
DNS-based
Of course, another way to encode these numerical URLs is to create A
/
AAAA
records for them under a domain you control. I've done this under my
personal domain:
- http://t127.fmarier.org/ (
127.0.0.1
) - http://t1aaaa.fmarier.org/ (
[::1]
) - http://t0.fmarier.org/ (
0.0.0.0
) - http://t0aaaa.fmarier.org/ (
[::]
) - http://t127aaaam.fmarier.org/ (
[::ffff:7f00:1]
) - http://t0aaaam.fmarier.org/ (
[::ffff:0000:0000]
)
For these to work, you'll need to:
- Make sure you can connect to IPv6-only hosts, for example by connecting to an appropriate VPN if needed.
- Put
nameserver 8.8.8.8
in/etc/resolv.conf
since you need a DNS server that will not filter these localhost domains. (For example, Unbound will do that if you useprivate-address: 127.0.0.0/8
in theserver
config.) - Go into
chrome://settings/security
and disable Always use secure connections to make sure the OS resolver is used. - Turn off the
chrome://flags/#block-insecure-private-network-requests
flag since that security feature (CORS-RFC1918) is designed to protect against these kinds of requests.
127.0.0.0/8
subnet
Technically, the entire 127.0.0.0/8
subnet can used to refer to the local
machine. However, it's not a reliable way to portscan a machine from a web
browser because it only catches the services that listen on all interfaces
(i.e. 0.0.0.0
).
For example, on my machine, if I nmap 127.0.0.1
, I get:
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1
25/tcp open smtp Postfix smtpd
whereas if I nmap 127.0.1.25
, I only get:
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1
That's because I've got the following in /etc/postfix/main.cf
:
inet_interfaces = loopback-only
which I assume is explicitly binding 127.0.0.1
.
Nevertheless, it would be good to get that fixed in Brave too.
After upgrading my MythTV machine to Debian Bullseye and MythTV 31, my Streamzap remote control stopped working correctly: the up and down buttons were working, but the OK button wasn't.
Here's the complete solution that made it work with the built-in kernel support (i.e. without LIRC).
Button re-mapping
Since some of the buttons were working, but not others, I figured that the buttons were probably not mapped to the right keys.
Inspired by these old v4l-utils
-based
instructions,
I made my own custom keymap by by copying the original keymap:
cp /lib/udev/rc_keymaps/streamzap.toml /etc/rc_keymaps/
and then modifying it to adapt it to what MythTV needs. This is what I ended up with:
[[protocols]]
name = "streamzap"
protocol = "rc-5-sz"
[protocols.scancodes]
0x28c0 = "KEY_0"
0x28c1 = "KEY_1"
0x28c2 = "KEY_2"
0x28c3 = "KEY_3"
0x28c4 = "KEY_4"
0x28c5 = "KEY_5"
0x28c6 = "KEY_6"
0x28c7 = "KEY_7"
0x28c8 = "KEY_8"
0x28c9 = "KEY_9"
0x28ca = "KEY_ESC"
0x28cb = "KEY_MUTE"
0x28cc = "KEY_UP"
0x28cd = "KEY_RIGHTBRACE"
0x28ce = "KEY_DOWN"
0x28cf = "KEY_LEFTBRACE"
0x28d0 = "KEY_UP"
0x28d1 = "KEY_LEFT"
0x28d2 = "KEY_ENTER"
0x28d3 = "KEY_RIGHT"
0x28d4 = "KEY_DOWN"
0x28d5 = "KEY_M"
0x28d6 = "KEY_ESC"
0x28d7 = "KEY_L"
0x28d8 = "KEY_P"
0x28d9 = "KEY_ESC"
0x28da = "KEY_BACK"
0x28db = "KEY_FORWARD"
0x28dc = "KEY_R"
0x28dd = "KEY_PAGEUP"
0x28de = "KEY_PAGEDOWN"
0x28e0 = "KEY_D"
0x28e1 = "KEY_I"
0x28e2 = "KEY_END"
0x28e3 = "KEY_A"
Note that the keycodes can be found in the kernel source code.
With my own keymap in place at /etc/rc_keymaps/streamzap.toml
, I changed
/etc/rc_maps.cfg
to have the kernel driver automatically use it:
--- a/rc_maps.cfg
+++ b/rc_maps.cfg
@@ -126,7 +126,7 @@
* rc-real-audio-220-32-keys real_audio_220_32_keys.toml
* rc-reddo reddo.toml
* rc-snapstream-firefly snapstream_firefly.toml
-* rc-streamzap streamzap.toml
+* rc-streamzap /etc/rc_keymaps/streamzap.toml
* rc-su3000 su3000.toml
* rc-tango tango.toml
* rc-tanix-tx3mini tanix_tx3mini.toml
Button repeat delay
To adjust the delay before button presses are repeated, I followed these
old out-of-date
instructions
on the MythTV wiki and put the following in
/etc/udev/rules.d/streamzap.rules
:
ACTION=="add", ATTRS{idVendor}=="0e9c", ATTRS{idProduct}=="0000", RUN+="/usr/bin/ir-keytable -s rc0 -D 1000 -P 250"
Note that the -d
option has been replaced with -s
in the latest version
of ir-keytable
.
To check that the Streamzap is indeed detected as rc0
on your system, use
this command:
$ ir-keytable
Found /sys/class/rc/rc0/ with:
Name: Streamzap PC Remote Infrared Receiver (0e9c:0000)
Driver: streamzap
Default keymap: rc-streamzap
...
Make sure you don't pass the -c
to ir-keytable
or else it will clear the
keymap set via /etc/rc_maps.cfg
, removing all of the button mappings.