Fixes required to enable pre-commit.

This commit is contained in:
Krzysztof Burghardt 2024-09-02 09:25:17 +02:00
parent 81936e960f
commit e59cb10329
No known key found for this signature in database
GPG Key ID: 20D1B02D50095EA7
9 changed files with 23 additions and 17 deletions

View File

@ -20,9 +20,9 @@ test_task:
- cd tests && ./runtests.bash
configure_script:
- echo none > fwtype.txt
1st_test_run_script:
first_test_run_script:
- ./easy-wg-quick
2nd_test_run_script:
second_test_run_script:
- ./easy-wg-quick named_client
dump_configuration_script:
- head *.txt *.key *.conf

View File

@ -231,7 +231,7 @@ set interface name in `extnetif.txt` file with command:
By default `easy-wg-quick` uses IP address of interface that has default
routing done over it as external IP address of VPN hub. This might not be true
if hub is behind firewall or NAT/PAT/masquarading is done. User can set
prefered IP address in `extnetip.txt` file with command:
preferred IP address in `extnetip.txt` file with command:
echo 192.168.1.2 > extnetip.txt

View File

@ -465,7 +465,7 @@ MTU = $INT_NET_MTU
[Peer]
PublicKey = $(wg pubkey < wghub.key)
PresharedKey = $(wg genpsk | tee "wgclient_$CONF_NAME.psk")
AllowedIPs = $INT_NET_CLINET_ALLOWEDIPS
AllowedIPs = $INT_NET_CLIENT_ALLOWEDIPS
Endpoint = $EXT_NET_IP:$EXT_NET_PORT
PersistentKeepalive = 25
EOF
@ -496,7 +496,7 @@ $($NET6 && echo " list dns '$INT_NET6_DNS'")
option mtu '$INT_NET_MTU'
config wireguard_wg0
$(allowedips_to_uci_list "$INT_NET_CLINET_ALLOWEDIPS")
$(allowedips_to_uci_list "$INT_NET_CLIENT_ALLOWEDIPS")
option route_allowed_ips '1'
option endpoint_host '$EXT_NET_IP'
option endpoint_port '$EXT_NET_PORT'
@ -612,7 +612,7 @@ write_initial_configuration() {
INT_NET_ADDRESS_MASK="/32"
INT_NET_HUB_IP="${INT_NET_ADDRESS}1"
test -f intnetallowedips.txt || create_client_allowedips
INT_NET_CLINET_ALLOWEDIPS="$(get_client_allowedips)"
INT_NET_CLIENT_ALLOWEDIPS="$(get_client_allowedips)"
test -f fwtype.txt || create_fw_type
FW_TYPE="$(get_fw_type)"
@ -643,7 +643,7 @@ write_initial_configuration() {
}
print_usage() {
echo "Usage: $0 [client_name] - create new clinet with optional [client_name]"
echo "Usage: $0 [client_name] - create new client with optional [client_name]"
echo " $0 --init - create initial configuration without any clients"
echo " $0 --clear - clear the configuration and start over"
exit 1

View File

@ -1,3 +1,5 @@
#!/usr/bin/env bash
# create configuration
sudo ip netns exec hub ../easy-wg-quick loop

View File

@ -13,7 +13,7 @@ load teardown setup
[[ "$status" -eq 0 ]]
}
@test "run with too smal MTU set" {
@test "run with too small MTU set" {
echo 1200 > intnetmtu.txt
run ../easy-wg-quick toosmalmtu
[[ "$status" -eq 1 ]]

View File

@ -6,11 +6,11 @@ load teardown setup
run ../easy-wg-quick
[[ "$status" -eq 0 ]]
[[ "${#lines[@]}" -gt 3 ]]
RANDOM_PORT_1ST="$(grep ListenPort wghub.conf | awk '{ print $3 }')"
RANDOM_PORT_FIRST="$(grep ListenPort wghub.conf | awk '{ print $3 }')"
teardown
run ../easy-wg-quick
[[ "$status" -eq 0 ]]
[[ "${#lines[@]}" -gt 3 ]]
RANDOM_PORT_2ND="$(grep ListenPort wghub.conf | awk '{ print $3 }')"
[[ "${RANDOM_PORT_1ST}" -ne "${RANDOM_PORT_2ND}" ]]
RANDOM_PORT_SECOND="$(grep ListenPort wghub.conf | awk '{ print $3 }')"
[[ "${RANDOM_PORT_FIRST}" -ne "${RANDOM_PORT_SECOND}" ]]
}

View File

@ -7,7 +7,7 @@ load teardown setup
[[ "$status" -eq 0 ]]
[[ "${#lines[@]}" -gt 10 ]]
run cat intnetaddress.txt
saved_1st_output="$output"
saved_first_output="$output"
[[ "$status" -eq 0 ]]
[[ "${#lines[@]}" -eq 1 ]]
@ -16,11 +16,11 @@ load teardown setup
[[ "$status" -eq 0 ]]
[[ "${#lines[@]}" -gt 10 ]]
run cat intnetaddress.txt
saved_2nd_output="$output"
saved_second_output="$output"
[[ "$status" -eq 0 ]]
[[ "${#lines[@]}" -eq 1 ]]
[[ "$saved_1st_output" != "$saved_2nd_output" ]]
[[ "$saved_first_output" != "$saved_second_output" ]]
}
@test "run to create random IPv6 network address" {
@ -29,7 +29,7 @@ load teardown setup
[[ "$status" -eq 0 ]]
[[ "${#lines[@]}" -gt 10 ]]
run cat intnet6address.txt
saved_1st_output="$output"
saved_first_output="$output"
[[ "$status" -eq 0 ]]
[[ "${#lines[@]}" -eq 1 ]]
@ -38,9 +38,9 @@ load teardown setup
[[ "$status" -eq 0 ]]
[[ "${#lines[@]}" -gt 10 ]]
run cat intnet6address.txt
saved_2nd_output="$output"
saved_second_output="$output"
[[ "$status" -eq 0 ]]
[[ "${#lines[@]}" -eq 1 ]]
[[ "$saved_1st_output" != "$saved_2nd_output" ]]
[[ "$saved_first_output" != "$saved_second_output" ]]
}

View File

@ -1,3 +1,5 @@
#!/usr/bin/env bash
# create namespaces
sudo ip netns add hub
sudo ip netns add client

View File

@ -1,3 +1,5 @@
#!/usr/bin/env bash
# cleanup
sudo ip link delete veth_hub
sudo ip link delete veth_client