Skip to content

Implementation of IPv6 support#151

Open
tricovictor wants to merge 10 commits into
Stouts:developfrom
UdelaRInterior:implementation-IPv6
Open

Implementation of IPv6 support#151
tricovictor wants to merge 10 commits into
Stouts:developfrom
UdelaRInterior:implementation-IPv6

Conversation

@tricovictor
Copy link
Copy Markdown

openvpn_ipv6_enabled is defined for ipv6 support.
Also openvpm_ipv6_route_ranges, where we define an array of network ranges to use.
For example:
openvpn_ipv6_route_ranges:

  • 2000:1::/64
  • 2000:3::/64

@tricovictor
Copy link
Copy Markdown
Author

Missing \ n to run molecule correctly here

@nkakouros
Copy link
Copy Markdown
Collaborator

@tricovictor Do you need sth from me to fix the PR?

@tricovictor
Copy link
Copy Markdown
Author

Hi @nkakouros. I not is acquainted with Molecule but the task "Set IPv6 forwarding in the sysctl file and reload if necessary" in /task/system/fordwarding.yml is reporting:

errorIpv6

I suppose it is solved as the task but from IPV4 by placing:
when: 'not lookup('env', 'IN_MOLECULE') | d(true, true) | bool'
and add openvpn_ipv6_server is defined

Comment thread tasks/system/forwarding.yml Outdated
sysctl_set: true
state: present
reload: true
when: not lookup('env', 'IN_MOLECULE') | d(true, true) | bool and openvpn_ipv6_server is defined
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you break this when into a list?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in c1cbc8c

reload: true
when: not lookup('env', 'IN_MOLECULE') | d(true, true) | bool

- name: Set IPv6 forwarding in the sysctl file and reload if necessary
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also rename the previous task to say IPv4?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in c1cbc8c

Comment thread templates/server.conf.j2 Outdated
# TCP or UDP server?
proto {{ openvpn_proto }}

{% if openvpn_ipv6_enabled %}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add | bool for consistency.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in c1cbc8c

Comment thread templates/server.conf.j2 Outdated
# most systems, the VPN will not function unless you partially or fully disable
# the firewall for the TUN/TAP interface.
dev {{ openvpn_dev }}
{% if openvpn_ipv6_enabled %}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add | bool for consistency.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in c1cbc8c

Comment thread templates/server.conf.j2
@@ -31,6 +36,9 @@ cipher {{ openvpn_cipher }}
# most systems, the VPN will not function unless you partially or fully disable
# the firewall for the TUN/TAP interface.
dev {{ openvpn_dev }}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you leave the non-ipv6 options outside of a conditional? Does this work?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this works

Comment thread templates/server.conf.j2 Outdated
# 10.8.0.1. Comment this line out if you are ethernet bridging. See the man
# page for more info.
server {{ openvpn_server }}
{% if openvpn_ipv6_enabled and openvpn_ipv6_server is defined %}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add | bool

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in c1cbc8c

Comment thread templates/server.conf.j2 Outdated
{% if openvpn_ipv6_enabled and openvpn_ipv6_server is defined %}
server-ipv6 {{ openvpn_ipv6_server }}
ifconfig-ipv6 {{ openvpn_ipv6_ifconfig }}
push "route-ipv6-default {{ openvpn_ipv6_route_default }}"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find an option named route-ipv6-default. Where is this documented?

Also, why do you need lines 86-87 unconditionally when ipv6 is used?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openvpn_ipv6_server is defined will always be true. This variable is defined in defaults/main.yml as an empty string, what will matter in this template is if it's still empty or not.

According to the OpenVPN wiki

There are 2 ways to add IPv6 addressing and pool options to the server, similar to what OpenVPN supports for IPv4: using a helper-directive, and by expanding the helper-directive. The expansion is required if you do not wish to use the automatic values the helper-directive supplies.

  • therefore ifconfig-ipv6 will be a complementary and optional configuration
  • route-ipv6-default doesn't exist, it's optional, and can be pushed with the variable openvpn_ipv6_route_ranges which is defined as an empty list by default.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in c1cbc8c

@santiagomr
Copy link
Copy Markdown

I added to this PR the fix to the IP forwarding discussed here, since it's necessary for both IPv4 (#159) and IPv6.

Do you think that something else is missing to merge this PR? Please note that we (@UdelaRInterior) are an organization. @tricovictor, @ulvida, and I (@santiagomr) are working together on this fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants