Skip to content

Commit 70aa11a

Browse files
committed
Add ipv6_link_local option
1 parent 39c0502 commit 70aa11a

File tree

5 files changed

+40
-12
lines changed

5 files changed

+40
-12
lines changed

comitup/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def load_data() -> Tuple[Config, persist.persist]:
7373
"enable_appliance_mode": "1",
7474
"primary_wifi_device": "",
7575
"enable_nuke": "0",
76+
"ipv6_link_local": 1,
7677
},
7778
)
7879

comitup/nm.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,10 @@ def make_hotspot(name="comitup", device=None, password="", hash="0000"):
274274

275275

276276
def make_connection_for(
277-
ssid: str, password: str = None, interface: Optional[str] = None
277+
ssid: str,
278+
password: str = None,
279+
interface: Optional[str] = None,
280+
link_local: bool = True,
278281
) -> None:
279282
settings = dbus.Dictionary(
280283
{
@@ -299,12 +302,15 @@ def make_connection_for(
299302
),
300303
"ipv6": dbus.Dictionary(
301304
{
302-
"method": "auto",
305+
"method": "link-local",
303306
}
304307
),
305308
}
306309
)
307310

311+
if not link_local:
312+
settings["ipv6"]["method"] = "auto"
313+
308314
if interface:
309315
settings["connection"]["interface-name"] = interface
310316

comitup/statemgr.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ def to_fn(ssid, password):
9090
if nm.get_connection_by_ssid(ssid):
9191
nm.del_connection_by_ssid(ssid)
9292

93-
nm.make_connection_for(ssid, password)
93+
nm.make_connection_for(
94+
ssid, password, link_local=conf.getboolean("ipv6_link_local")
95+
)
9496

9597
states.set_state("CONNECTING", [ssid, ssid])
9698
return False

conf/comitup.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,15 @@
8282
# defined WiFi connections, flash the board LED 3 times, and restart Comitup.
8383
#
8484
# enable_nuke: 0
85+
86+
# ipv6_link_local
87+
#
88+
# Typically, IPv4 addresses assigned by ISPs involve Network Address
89+
# Translation. This offers some protection to devices, since such addresses are
90+
# not routable from the Internet by default. This is not the case for IPv6. In
91+
# this case, extra steps often need to be taken to protect the device. This
92+
# option can force Comitup to configure IPv6 on upstream WiFi connections to be
93+
# configured only with link-local IPv6 addresses, making them inaccessible from
94+
# the Internet for that protocol.
95+
#
96+
# ipv6_link_local: 1

doc/comitup-conf.5.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% comitup-conf(5)
22
%
3-
% June 2021
3+
% July 2021
44

55
# NAME
66

@@ -13,7 +13,7 @@ It is located in the _/etc/_ directory.
1313

1414
## PARAMETERS
1515

16-
* _ap_name_:
16+
* _ap\_name_:
1717
By default, comitup will create a hotspot named **comitup-<nnn>**,
1818
publish an avahi-daemon(8) host entry for **comitup-<nnn>**, and establish
1919
an mdns identity for **comitup-<nnn>.local**. Setting this parameter will
@@ -22,33 +22,33 @@ It is located in the _/etc/_ directory.
2222
will be replaced with a persistent, random number. Similarly, the string
2323
<hostname> is replaced with the computer's hostname.
2424

25-
* _ap_password_:
25+
* _ap\_password_:
2626
If this parameter is defined in the configuration file, then the comitup hotspot will
2727
require that any connection to the hotspot be authenticated, using this password.
2828

29-
* _web_service_:
29+
* _web\_service_:
3030
This defines a user web service to be controlled by **comitup**. This service will be
3131
disabled in the **HOTSPOT** state in preference of the comitup web service, and will be
3232
enabled in the **CONNECTED** state. This should be the name of the systemd web service,
3333
such as _apache2.service_ or _nginx.service_. This defaults to a null string,
3434
meaning no service is controlled.
3535

36-
* _service_name_:
36+
* _service\_name_:
3737
This defines the mdns service name advertised by **comitup**. This defaults to "comitup",
3838
and will be advertised as "_comitup._tcp".
3939

40-
* _enable_appliance_mode_:
40+
* _enable\_appliance\_mode_:
4141
By default, comitup will use multiple wifi interfaces, if available, to connect to the
4242
local hotspot and to the internet simultaneously. Setting this to something other than
4343
"true" will limit comitup to the first wifi interface.
4444

45-
* _external_callback_:
45+
* _external\_callback_:
4646

4747
The path to an external script that is called on comitup state changes. It will include
4848
a single argument, either 'HOTSPOT', 'CONNECTING', or 'CONNECTED'. The script will run
4949
as the owning user and group.
5050

51-
* _primary_wifi_device_;
51+
* _primary\_wifi\_device_;
5252

5353
Override the default choice for the primary WiFi device to use.
5454

@@ -65,9 +65,16 @@ It is located in the _/etc/_ directory.
6565

6666
This capability is also availble via _comitup-cli_ and the D-BUS interface.
6767

68+
* _ipv6\_link\_local_;
69+
70+
Set to '1' to force Comitup to create only "link-local" IPv6 addresses for
71+
the upstream WiFi connection, affording a higher level of protection for
72+
that link. "link-local" addresses cannot route to the Internet. Delete
73+
existing connections after changing the value of this parameter.
74+
6875
## COPYRIGHT
6976

70-
Comitup is Copyright (C) 2016-2019 David Steele <steele@debian.org>
77+
Comitup is Copyright (C) 2016-2021 David Steele <steele@debian.org>
7178

7279
## SEE ALSO
7380

0 commit comments

Comments
 (0)