Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test internet connectivity of the machines #159

Merged
merged 32 commits into from
Jul 18, 2024
Merged

Test internet connectivity of the machines #159

merged 32 commits into from
Jul 18, 2024

Conversation

robertvolkmann
Copy link
Contributor

@robertvolkmann robertvolkmann commented Apr 19, 2024

  • Added targets to ssh into the firewall and machine in both flavors
  • Added target to curl against cloudflare
  • Use frr container for internet vrf also for cumulus

@robertvolkmann robertvolkmann requested a review from a team as a code owner April 19, 2024 08:20
@robertvolkmann
Copy link
Contributor Author

@Gerrit91 do we still need these lines in the integration test script?

echo "Adding route to leaf01 and leaf02"
make route

echo "Check if SSH login to firewall works"
# FIXME: Again this is unstable in CI integration tests
# ssh -o StrictHostKeyChecking=no [email protected] -C exit

@robertvolkmann
Copy link
Contributor Author

robertvolkmann commented Jun 6, 2024

ssh login over link-local addresses is prohibited because these are not part of hosts.allowed anymore.

@majst01 Any reason not to include link-local addresses?

@majst01
Copy link
Contributor

majst01 commented Jun 7, 2024

ssh login over link-local addresses is prohibited because these are not part of hosts.allowed anymore.

@majst01 Any reason not to include link-local addresses?

This was part of the requirements from the CIS benchmark. I think we can allow ssh access from localhost.

@robertvolkmann
Copy link
Contributor Author

Do we need the SSH access only for the integration tests?

@majst01
Copy link
Contributor

majst01 commented Jun 7, 2024

Do we need the SSH access only for the integration tests?

It is actually in the hosts.allow:



ALL: [fc00::]/7
ALL: 10.0.0.0/8
ALL: 100.64.0.0/10
ALL: 172.16.0.0/12
ALL: 192.168.0.0/16
ALL: 127.0.0.0/8

Is the ipv6 link local missing ?

@robertvolkmann
Copy link
Contributor Author

robertvolkmann commented Jun 7, 2024

Yes, the LLA range fe80::/10 is not contained within the ULA range fc00::/7. Adding the LLA range to hosts.allow would allow SSH connections from the leaves to the machines.

@majst01
Copy link
Contributor

majst01 commented Jun 7, 2024

Yes, the LLA range fe80::/10 is not contained within the ULA range fc00::/7. Adding the LLA range to hosts.allow would allow SSH connections from the leaves to the machines.

But this is not intended for production, can we modify this only in the integration tests in mini-lab ?

@robertvolkmann
Copy link
Contributor Author

Can I change hosts.allow by providing some ignition file with --userdata or should I use the serial console?

@majst01
Copy link
Contributor

majst01 commented Jun 7, 2024

Can I change hosts.allow by providing some ignition file with --userdata or should I use the serial console?

Userdata should be the simplest way as long as you only test the metal-only use case. With gardener the userdata is generated by os-metal-extension

files/ignition.json Outdated Show resolved Hide resolved
@robertvolkmann
Copy link
Contributor Author

The firewall has access to the internet, but the machine does not. Packets arrive at the firewall but do not enter the vrf104009.

root@fw:~# tcpdump -i any -n icmp
13:53:49.074232 vni20 P   IP 10.0.0.2 > 1.1.1.1: ICMP echo request, id 17, seq 257, length 64
13:53:49.074232 bridge In  IP 10.0.0.2 > 1.1.1.1: ICMP echo request, id 17, seq 257, length 64
13:53:49.074232 vlan20 In  IP 10.0.0.2 > 1.1.1.1: ICMP echo request, id 17, seq 257, length 64

But the route leaking looks good.

fw# show ip route vrf vrf20
Codes: K - kernel route, C - connected, L - local, S - static,
       R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
       f - OpenFabric, t - Table-Direct,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

VRF vrf20:
B>* 0.0.0.0/0 [20/0] via 10.0.0.21, vlan104009 (vrf vrf104009) onlink, weight 1, 00:04:40
L * 10.0.0.1/32 is directly connected, vlan20, 01:42:37
C>* 10.0.0.1/32 is directly connected, vlan20, 01:42:37
B>* 10.0.0.2/32 [20/0] via 10.0.0.11, vlan20 onlink, weight 1, 00:04:40
  *                    via 10.0.0.12, vlan20 onlink, weight 1, 00:04:40

@robertvolkmann
Copy link
Contributor Author

robertvolkmann commented Jul 12, 2024

Firewall images not containing the PR metal-stack/metal-images#214 work on my machine. But outgoing access still doesn't work on our CI system.

@majst01 Any workaround for the PR?

@majst01
Copy link
Contributor

majst01 commented Jul 13, 2024

Firewall images not containing the PR metal-stack/metal-images#214 work on my machine. But outgoing access still doesn't work on our CI system.

@majst01 Any workaround for the PR?

The firewall creation in the mini-lab must contain a initial ruleset to allow traffic, see metalctl firewall create -h

     --firewall-rules-file string   firewall rules specified in a yaml file                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                           
                                     Example:                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                           
                                     $ metalctl firewall create ..mandatory args.. --firewall-rules-file rules.yaml                                                                                                                                                                        
                                                                                                                                                                                                                                                                                           
                                     rules.yaml                                                                                                                                                                                                                                            
                                     ---                                                                                                                                                                                                                                                   
                                     egress:                                                                                                                                                                                                                                               
                                     - comment: allow outgoing https                                                                                                                                                                                                                       
                                       ports:                                                                                                                                                                                                                                              
                                       - 443                                                                                                                                                                                                                                               
                                       protocol: TCP                                                                                                                                                                                                                                       
                                       to:                                                                                                                                                                                                                                                 
                                       - 0.0.0.0/0                                                                                                                                                                                                                                         
                                     - comment: allow outgoing dns via tcp                                                                                                                                                                                                                 
                                       ports:                                                                                                                                                                                                                                              
                                       - 53                                                                                                                                                                                                                                                
                                       protocol: TCP                                                                                                                                                                                                                                       
                                       to:                                                                                                                                                                                                                                                 
                                       - 0.0.0.0/0                                                                                                                                                                                                                                         
                                     - comment: allow outgoing dns and ntp via udp                                                                                                                                                                                                         
                                       ports:                                                                                                                                                                                                                                              
                                       - 53                                                                                                                                                                                                                                                
                                       - 123                                                                                                                                                                                                                                               
                                       protocol: UDP                                                                                                                                                                                                                                       
                                       to:                                                                                                                                                                                                                                                 
                                       - 0.0.0.0/0                                                                                                                                                                                                                                         
                                     ingress:                                                                                                                                                                                                                                              
                                     - comment: allow incoming ssh only to one ip                                                                                                                                                                                                          
                                       ports:                                                                                                                                                                                                                                              
                                       - 22                                                                                                                                                                                                                                                
                                       protocol: TCP
                                       from:
                                       - 0.0.0.0/0
                                       - 1.2.3.4/32
                                       to:
                                       - 212.34.83.19/32
                                     - comment: allow incoming https to all targets
                                       ports:
                                       - 80
                                       - 433
                                       protocol: TCP
                                       from:
                                       - 0.0.0.0/0


@robertvolkmann
Copy link
Contributor Author

Jul 15 16:30:12 fw kernel: nftables-metal-dropped: IN=vrf20 OUT=vlan104009 MAC=42:61:1b:94:d5:5b:02:42:ac:11:00:04:08:00 SRC=10.0.0.2 DST=1.1.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=63395 DF PROTO=TCP SPT=46700 DPT=80 WINDOW=35840 RES=0x00 SYN URGP=0 

@robertvolkmann
Copy link
Contributor Author

firewall-controller.service and droptailer.service are in a crash loop.

@mwindower
Copy link
Contributor

The test tries to connect with port 80 which is not in the allowed rule set.

@majst01
Copy link
Contributor

majst01 commented Jul 16, 2024

BTW: Ping, e.g. ICMP is actually not supported with the firewall-rules set during boot :-)

You should check if you can curl https://1.1.1.1

@robertvolkmann
Copy link
Contributor Author

I already switched to https://1.1.1.1 but it still doesn't work on the GitHub runners.

@robertvolkmann
Copy link
Contributor Author

Accessing the internet from the machine works on the GitHub runner as well, but SSH login to the firewall still does not work.

@majst01
Copy link
Contributor

majst01 commented Jul 17, 2024

Accessing the internet from the machine works on the GitHub runner as well, but SSH login to the firewall still does not work.

This might be because there need to be a input rule added which allows ssh access

@robertvolkmann
Copy link
Contributor Author

robertvolkmann commented Jul 17, 2024

The firewalls have an input chain allowing SSH access:

tcp dport ssh ct state new counter accept comment "SSH incoming connections"

instead of the input chain that is present in production:

iifname "tailscale*" accept comment "Accept tailscale traffic"

It works locally without any issue but not on the GitHub runner.

Makefile Show resolved Hide resolved
@robertvolkmann
Copy link
Contributor Author

@majst01 Thanks for remaining on: It’s always MTU, unless it’s DNS.

@Gerrit91
Copy link
Contributor

LGTM

@majst01 majst01 merged commit d31688b into master Jul 18, 2024
2 checks passed
@majst01 majst01 deleted the ping-test branch July 18, 2024 12:27
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.

4 participants