diff --git a/content/posts/creating_this_site/index.adoc b/content/posts/creating_this_site/index.adoc index 490d456..88a4a7e 100644 --- a/content/posts/creating_this_site/index.adoc +++ b/content/posts/creating_this_site/index.adoc @@ -7,6 +7,7 @@ menu: sidebar: name: Creating this site identifier: creating_this_site + weight: 10 --- = Creating this site Marko Korhonen diff --git a/content/posts/creating_this_site/index.fi.adoc b/content/posts/creating_this_site/index.fi.adoc index 4840946..952aa83 100644 --- a/content/posts/creating_this_site/index.fi.adoc +++ b/content/posts/creating_this_site/index.fi.adoc @@ -7,6 +7,7 @@ menu: sidebar: name: Tämän sivun luominen identifier: creating_this_site + weight: 10 --- = Tämän sivuston luominen Marko Korhonen diff --git a/content/posts/firewall_rules_openwrt_ipv6_dynamic_prefix/assets/writing_blogpost_neovim_hugo.png b/content/posts/firewall_rules_openwrt_ipv6_dynamic_prefix/assets/writing_blogpost_neovim_hugo.png new file mode 100644 index 0000000..af520af Binary files /dev/null and b/content/posts/firewall_rules_openwrt_ipv6_dynamic_prefix/assets/writing_blogpost_neovim_hugo.png differ diff --git a/content/posts/firewall_rules_openwrt_ipv6_dynamic_prefix/featured.jpg b/content/posts/firewall_rules_openwrt_ipv6_dynamic_prefix/featured.jpg new file mode 120000 index 0000000..fe7fa3d --- /dev/null +++ b/content/posts/firewall_rules_openwrt_ipv6_dynamic_prefix/featured.jpg @@ -0,0 +1 @@ +hero.jpg \ No newline at end of file diff --git a/content/posts/firewall_rules_openwrt_ipv6_dynamic_prefix/hero.jpg b/content/posts/firewall_rules_openwrt_ipv6_dynamic_prefix/hero.jpg new file mode 100644 index 0000000..95138ef Binary files /dev/null and b/content/posts/firewall_rules_openwrt_ipv6_dynamic_prefix/hero.jpg differ diff --git a/content/posts/firewall_rules_openwrt_ipv6_dynamic_prefix/index.adoc b/content/posts/firewall_rules_openwrt_ipv6_dynamic_prefix/index.adoc new file mode 100644 index 0000000..9660934 --- /dev/null +++ b/content/posts/firewall_rules_openwrt_ipv6_dynamic_prefix/index.adoc @@ -0,0 +1,60 @@ +--- +title: OpenWRT firewall rules with with dynamic IPv6 prefix +description: Easier firewall rules in OpenWRT when you have a dynamic IPv6 prefix. +date: 2024-06-10 +featured_image: hero.jpg +menu: + sidebar: + name: Firewall rules with OpenWRT and dynamic IPv6 prefix + identifier: firewall_rules_openwrt_ipv6_dynamic_prefix + weight: 30 +--- += Firewall rules with OpenWRT and dynamic IPv6 prefix +Marko Korhonen +v1.0, 2024-06-10 + +I recently got IPv6 connectivity at my house, so naturally I wanted to add IPv6 support for my server. I ran into some difficulties that I didn't find documented in a single place so here is the solution I came up with. + +== The problem + +I quickly discovered that my ISP is not doing the IPv6 support "right", they are not giving me a /56 prefix with prefix delegation but instead a /64 prefix that cannot be further divided into subnets. This is true for all mobile operators in Finland and I cannot get anything else in my current address so this will have to do. + +The lack of prefix delegation means that I have to set RA and NDP to relay mode in OpenWRT and I have no control over the IPv6 addresses that are assigned to my devices. That in turn means I cannot create static firewall rules based on those addresses because they can change any time. + +For a few weeks I got by with manually changing the firewall rules every time the prefix changed but that was not a sustainable because I have a lot of firewall rules. + +== Turning off IPv6 SLAAC privacy extensions + +While I couldn't have a predictable prefix, I can have a predicatble suffix by turning off the IPv6 SLAAC privacy extensions on my server. This way the suffix (the host part) is derived from the MAC address of the device and it will always stay the same. + +SLAAC privacy extensions exist for a reason, to increase privacy by generating a random identifier that changes over time. I don't think that is a problem for my server because it is open to the public anyway and the main reason for privacy extensions is so that mobile devices can't be tracked across networks and my server obviously stays in the same network all the time. It's good to acknowledge that this effectively makes your MAC address public, but I don't personally see an obvious risk in that. + +I'm using NetworkManager on my server. You can turn off privacy extensions by locating your interface configuration under `/etc/NetworkManager/system-connections/`. For me it was `Wired connection 1.nmconnection`. Add/change the following lines in the `[ipv6]` section: + +[source,config] +---- +[ipv6] +addr-gen-mode=eui64 +method=auto +ip6-privacy=0 +---- + +After this, you can either restart NetworkManager or reboot the whole computer. Then your computer should have a new IPv6 address. + +The logic by which the IPv6 address is calculated now is called EUI-64. I found a great tool to test and better understand it: link:https://eui64-calc.princelle.org/[the EUI-64 Calculator]. + +== Dynamic prefix forwarding + +I discovered that in OpenWRT firewall rules, part of the target address can be dynamic. This technique is called dynamic prefix forwarding. As I understand it, it is specific to OpenWRT, so this syntax doesn't probably work in other firewalls. With this technique we can use the static host part we set for the server in the previous part as the firewall rule's target IP address. + +[cols="1,>s"] +|=== +|*Server IPv6 address* +|`2001:14bb:8ad:6b:f279:59ff:fe65:f9e4` +|*Firewall rule target address* +|`::f279:59ff:fe65:f9e4/-64` +|=== + +Here you can see the current IPv6 address of my server and the resulting firewall rule target address. The `/-64` tells the firewall to ignore the first 64 bits of the address and only look at the 64 bits at the end, which is the host part. + +For more information about the firewall configuration, you can refer to the link:https://openwrt.org/docs/guide-user/firewall/fw3_configurations/fw3_ipv6_examples#dynamic_prefix_forwarding[OpenWRT wiki] diff --git a/content/posts/firewall_rules_openwrt_ipv6_dynamic_prefix/index.fi.adoc b/content/posts/firewall_rules_openwrt_ipv6_dynamic_prefix/index.fi.adoc new file mode 100644 index 0000000..d9aa886 --- /dev/null +++ b/content/posts/firewall_rules_openwrt_ipv6_dynamic_prefix/index.fi.adoc @@ -0,0 +1,60 @@ +--- +title: OpenWRT palomuurisäännöt dynaamisella IPv6-prefixillä +description: Helpommat palomuurisäännöt OpenWRT:n kanssa, kun käytössä on dynaaminen IPv6-prefix. +date: 2024-06-10 +featured_image: hero.jpg +menu: + sidebar: + name: Palomuurisäännöt OpenWRT:llä ja dynaamisella IPv6-prefixillä + identifier: firewall_rules_openwrt_ipv6_dynamic_prefix + weight: 30 +--- += Palomuurisäännöt OpenWRT:llä ja dynaamisella IPv6-prefixillä +Marko Korhonen +v1.0, 2024-06-10 + +Sain äskettäin IPv6-yhteyden kotiini, joten halusin luonnollisesti lisätä IPv6-tuen palvelimelleni. Törmäsin muutamiin ongelmiin, joita en löytänyt dokumentoituna yhdessä paikassa, joten tässä löytämäni ratkaisu. + +== Ongelma + +Huomasin nopeasti, että Internet-palveluntarjoajani ei ole toteuttanut IPv6-tukea "oikein". En saa /56 prefixiä prefix delegoinnilla vaan /64-prefixin, jota ei voi jakaa edelleen aliverkkoihin. Tämä pätee kaikkiin mobiilioperaattoreihin Suomessa, ja koska en voi saada kiinteää yhteyttä nykyiseen osoitteeseeni niin tämän on riitettävä. + +Prefix delegoinnin puute tarkoittaa, että minun on asetettava RA ja NDP relay tilaan OpenWRT:ssä, eikä minulla ole kontrollia IPv6-osoitteisiin jotka laitteeni saavat. Tämä puolestaan tarkoittaa, että en voi luoda pysyviä palomuurisääntöjä näiden osoitteiden perusteella, koska ne voivat muuttua milloin tahansa. + +Muutaman viikon ajan selvisin manuaalisesti muuttamalla palomuurisääntöjä aina, kun prefix muuttui, mutta se ei ollut riittävän hyvä ratkaisu pitkässä juoksussa, koska minulla on paljon palomuurisääntöjä. + +== IPv6 SLAAC:n yksityisyyden laajennusten poistaminen käytöstä + +Vaikka en saa ennustettavaa prefixiä, voin saada ennustettavan suffixin poistamalla käytöstä IPv6 SLAAC:n yksityisyyden laajennukset käytöstä palvelimellani. Näin suffix (host osa) johdetaan laitteen MAC-osoitteesta ja se pysyy aina samana. + +SLAAC:n yksityisyyden laajennukset ovat olemassa syystä, lisäämään yksityisyyttä generoimalla satunnainen tunniste, joka muuttuu ajan myötä. En usko, että tämä on ongelma palvelimelleni, koska se on joka tapauksessa avoin julkisuudelle ja yksityisyyden laajennusten pääasiallinen syy on se, että mobiililaitteita ei voida seurata verkkojen välillä ja palvelimeni pysyy luonnollisesti aina samassa verkossa. On hyvä tiedostaa, että tämä käytännössä tekee MAC-osoitteestasi julkisen, mutta en henkilökohtaisesti näe siinä ilmeistä riskiä. + +Käytän NetworkManageria palvelimellani. Voit poistaa yksityisyyden laajennukset käytöstä etsimällä verkkoyhteytesi asetukset hakemistosta `/etc/NetworkManager/system-connections/`. Omalla palvelimellani se oli `Wired connection 1.nmconnection`. Lisää/muuta seuraavat rivit `[ipv6]`-osioon: + +[source,config] +---- +[ipv6] +addr-gen-mode=eui64 +method=auto +ip6-privacy=0 +---- + +Tämän jälkeen voit joko käynnistää NetworkManagerin tai koko koneen uudelleen. Sen jälkeen tietokoneellasi pitäisi olla uusi IPv6 osoite. + +Logiikkaa, jolla IPv6-osoite nyt lasketaan, kutsutaan EUI-64:ksi. Löysin loistavan työkalun sen testaamiseen ja paremmin ymmärtämiseen: link:https://eui64-calc.princelle.org/[EUI-64 calculator]. + +== Dynaamisen prefixin edelleenlähetys + +Löysin, että OpenWRT:ssä voi asettaa osan palomuurisäännön kohdeosoitteesta dynaamiseksi. Tätä tekniikkaa kutsutaan dynaamisen prefixin edelleenlähetykseksi. Käsittääkseni se on OpenWRT spesifinen ominaisuus, joten tämä syntaksi ei siis todennäköisesti toimi muissa palomuureissa. Tämän tekniikan avulla voimme käyttää staattista host osaa palomuurisäännön kohdeosoitteena, jonka asetimme palvelimelle edellisessä osassa. + +[cols="1,>s"] +|=== +|*Palvelimen IPv6-osoite* +|`2001:14bb:8ad:6b:f279:59ff:fe65:f9e4` +|*Palomuurisäännön kohdeosoite* +|`::f279:59ff:fe65:f9e4/-64` +|=== + +Tässä näet palvelimeni nykyisen IPv6-osoitteen ja siitä johdetun palomuurisäännön kohdeosoitteen. `/-64` kertoo palomuurille, että se jättää huomioimatta osoitteen ensimmäiset 64 bittiä ja tarkastelee vain osoitteen viimeisiä 64 bittiä, jotka ovat host osa. + +Lisätietoja palomuurin asetuksista löydät link:https://openwrt.org/docs/guide-user/firewall/fw3_configurations/fw3_ipv6_examples#dynamic_prefix_forwarding[OpenWRT wikistä]. diff --git a/content/posts/migrate_misskey_root_account/index.adoc b/content/posts/migrate_misskey_root_account/index.adoc index 3dbff42..05c7c52 100644 --- a/content/posts/migrate_misskey_root_account/index.adoc +++ b/content/posts/migrate_misskey_root_account/index.adoc @@ -7,6 +7,7 @@ menu: sidebar: name: Migrate Misskey root account identifier: migrate_misskey_root_account + weight: 20 --- = Migrate Misskey root account diff --git a/content/posts/migrate_misskey_root_account/index.fi.adoc b/content/posts/migrate_misskey_root_account/index.fi.adoc index 3ef09dc..187ec83 100644 --- a/content/posts/migrate_misskey_root_account/index.fi.adoc +++ b/content/posts/migrate_misskey_root_account/index.fi.adoc @@ -8,6 +8,7 @@ menu: sidebar: name: Misskeyn root-tilin migraatio identifier: migrate_misskey_root_account + weight: 20 --- = Misskeyn root-tilin migraatio