From 3d1c3ad3fbd225fb934a2d98160e204386f4ce55 Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Thu, 3 Oct 2024 20:22:29 +0400 Subject: [PATCH 01/15] setup internet-access-vpn network --- scripts/nm-quick.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index bf94aa8c1..755a86f12 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -170,6 +170,8 @@ configure_netclient() { #setup failOver sleep 5 curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/v1/node/${NODE_ID}/failover" --header "Authorization: Bearer ${MASTER_KEY}" + sleep 2 + curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/v1/node/internet-access-vpn/${NODE_ID}/failover" -data '{}' --header "Authorization: Bearer ${MASTER_KEY}" set -e } @@ -741,12 +743,16 @@ setup_mesh() { echo "Creating netmaker network (100.64.0.0/16)" # TODO causes "Error Status: 400 Response: {"Code":400,"Message":"could not find any records"}" nmctl network create --name netmaker --ipv4_addr 100.64.0.0/16 + # create network for internet access vpn + if [ "$INSTALL_TYPE" = "pro" ]; then + nmctl network create --name internet-access-vpn --ipv4_addr 100.65.0.0/16 + fi wait_seconds 5 fi echo "Obtaining a netmaker enrollment key..." - local netmakerTag=$(nmctl enrollment_key list | jq -r '.[] | .tags[0]') + local netmakerTag=$(nmctl enrollment_key list | jq -r '.[] | .tags[0]' | grep -w "netmaker") if [[ ${netmakerTag} = "netmaker" ]]; then # key exists already, fetch token TOKEN=$(nmctl enrollment_key list | jq -r '.[] | select(.tags[0]=="netmaker") | .token') @@ -760,6 +766,24 @@ setup_mesh() { echo "Enrollment key ready" fi fi + + # if [ "$INSTALL_TYPE" = "pro" ]; then + # local inetTag=$(nmctl enrollment_key list | jq -r '.[] | .tags[0]' | grep -w "internet-access-vpn") + # if [[ ${inetTag} = "internet-access-vpn" ]]; then + # # key exists already, fetch token + # InetTOKEN=$(nmctl enrollment_key list | jq -r '.[] | select(.tags[0]=="internet-access-vpn") | .token') + # else + # local tokenJson=$(nmctl enrollment_key create --tags internet-access-vpn --unlimited --networks internet-access-vpn) + # InetTOKEN=$(jq -r '.token' <<<${tokenJson}) + # if test -z "$InetTOKEN"; then + # echo "Error creating an enrollment key" + # exit 1 + # else + # echo "Enrollment key ready" + # fi + # fi + + # fi wait_seconds 3 From cc0a2ae4b374496dda1c7c2e9e03b1fbd1eec573 Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Fri, 4 Oct 2024 12:30:45 +0400 Subject: [PATCH 02/15] fix inet gw creation req --- scripts/nm-quick.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index 755a86f12..00efa5745 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -171,7 +171,15 @@ configure_netclient() { sleep 5 curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/v1/node/${NODE_ID}/failover" --header "Authorization: Bearer ${MASTER_KEY}" sleep 2 - curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/v1/node/internet-access-vpn/${NODE_ID}/failover" -data '{}' --header "Authorization: Bearer ${MASTER_KEY}" + # create network for internet access vpn + if [ "$INSTALL_TYPE" = "pro" ]; then + echo "creating internet-access-vpn network" + nmctl network create --name internet-access-vpn --ipv4_addr 100.65.0.0/16 + sleep 5 + INET_NODE_ID=$(sudo cat /etc/netclient/nodes.json | jq -r .internet-access-vpn.id) + curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/v1/node/internet-access-vpn/${INET_NODE_ID}/inet_gw" -data '{}' --header "Authorization: Bearer ${MASTER_KEY}" + fi + set -e } @@ -743,10 +751,6 @@ setup_mesh() { echo "Creating netmaker network (100.64.0.0/16)" # TODO causes "Error Status: 400 Response: {"Code":400,"Message":"could not find any records"}" nmctl network create --name netmaker --ipv4_addr 100.64.0.0/16 - # create network for internet access vpn - if [ "$INSTALL_TYPE" = "pro" ]; then - nmctl network create --name internet-access-vpn --ipv4_addr 100.65.0.0/16 - fi wait_seconds 5 fi From 0060d2bd043e3f81391fa9d12066ca9ceeb16e0d Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Fri, 4 Oct 2024 12:33:53 +0400 Subject: [PATCH 03/15] fix inet gw creation req --- scripts/nm-quick.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index 00efa5745..a5b57aa6a 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -177,7 +177,7 @@ configure_netclient() { nmctl network create --name internet-access-vpn --ipv4_addr 100.65.0.0/16 sleep 5 INET_NODE_ID=$(sudo cat /etc/netclient/nodes.json | jq -r .internet-access-vpn.id) - curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/v1/node/internet-access-vpn/${INET_NODE_ID}/inet_gw" -data '{}' --header "Authorization: Bearer ${MASTER_KEY}" + curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/v1/nodes/internet-access-vpn/${INET_NODE_ID}/inet_gw" -data '{}' --header "Authorization: Bearer ${MASTER_KEY}" fi set -e From 675a900b9ab8df6ac8d34f767fd15b8b3c71e4c7 Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Fri, 4 Oct 2024 14:27:31 +0400 Subject: [PATCH 04/15] fix data arg --- scripts/nm-quick.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index a5b57aa6a..47de2188f 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -177,7 +177,7 @@ configure_netclient() { nmctl network create --name internet-access-vpn --ipv4_addr 100.65.0.0/16 sleep 5 INET_NODE_ID=$(sudo cat /etc/netclient/nodes.json | jq -r .internet-access-vpn.id) - curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/v1/nodes/internet-access-vpn/${INET_NODE_ID}/inet_gw" -data '{}' --header "Authorization: Bearer ${MASTER_KEY}" + curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/v1/nodes/internet-access-vpn/${INET_NODE_ID}/inet_gw" --data '{}' --header "Authorization: Bearer ${MASTER_KEY}" fi set -e From ea610281d1b2664949a9eb7a7c0c0b484974f2f9 Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Fri, 4 Oct 2024 18:41:34 +0400 Subject: [PATCH 05/15] update inet gw dns --- scripts/nm-quick.sh | 81 ++++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 37 deletions(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index 47de2188f..b80ffb8f7 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -173,10 +173,10 @@ configure_netclient() { sleep 2 # create network for internet access vpn if [ "$INSTALL_TYPE" = "pro" ]; then - echo "creating internet-access-vpn network" - nmctl network create --name internet-access-vpn --ipv4_addr 100.65.0.0/16 - sleep 5 INET_NODE_ID=$(sudo cat /etc/netclient/nodes.json | jq -r .internet-access-vpn.id) + nmctl node create_remote_access_gateway internet-access-vpn $INET_NODE_ID + out=$(nmctl node list -o json | jq -r '.[] | select(.id=="$INET_NODE_ID") | .ingressdns = "8.8.8.8"') + curl --location --request PUT "https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/internet-access-vpn/${INET_NODE_ID}" --data ${out} --header "Authorization: Bearer ${MASTER_KEY}" curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/v1/nodes/internet-access-vpn/${INET_NODE_ID}/inet_gw" --data '{}' --header "Authorization: Bearer ${MASTER_KEY}" fi @@ -743,51 +743,58 @@ test_connection() { setup_mesh() { wait_seconds 5 + netmakerNet=$(nmctl network list -o json | jq -r '.[] | .netid' | grep -w "netmaker") + inetNet=$(nmctl network list -o json | jq -r '.[] | .netid' | grep -w "internet-access-vpn") - local networkCount=$(nmctl network list -o json | jq '. | length') - - # add a network if none present - if [ "$networkCount" -lt 1 ]; then + # create netmaker network + if [[ ${netmakerNet} = "" ]]; then echo "Creating netmaker network (100.64.0.0/16)" # TODO causes "Error Status: 400 Response: {"Code":400,"Message":"could not find any records"}" nmctl network create --name netmaker --ipv4_addr 100.64.0.0/16 + wait_seconds 5 fi - - echo "Obtaining a netmaker enrollment key..." + # create enrollment key for netmaker network local netmakerTag=$(nmctl enrollment_key list | jq -r '.[] | .tags[0]' | grep -w "netmaker") - if [[ ${netmakerTag} = "netmaker" ]]; then - # key exists already, fetch token - TOKEN=$(nmctl enrollment_key list | jq -r '.[] | select(.tags[0]=="netmaker") | .token') - else - local tokenJson=$(nmctl enrollment_key create --tags netmaker --unlimited --networks netmaker) - TOKEN=$(jq -r '.token' <<<${tokenJson}) - if test -z "$TOKEN"; then - echo "Error creating an enrollment key" - exit 1 - else - echo "Enrollment key ready" + if [[ ${netmakerTag} = "" ]]; then + nmctl enrollment_key create --tags netmaker --unlimited --networks netmaker + fi + + # create internet-access-vpn + if [ "$INSTALL_TYPE" = "pro" ]; then + if [[ ${inetNet} = "" ]]; then + echo "Creating internet-access-vpn network (100.65.0.0/16)" + # TODO causes "Error Status: 400 Response: {"Code":400,"Message":"could not find any records"}" + nmctl network create --name internet-access-vpn --ipv4_addr 100.65.0.0/16 + wait_seconds 5 + fi + + # create enrollment key for internet-access-vpn network + local inetTag=$(nmctl enrollment_key list | jq -r '.[] | .tags[0]' | grep -w "internet-access-vpn") + if [[ ${inetTag} = "" ]]; then + nmctl enrollment_key create --tags internet-access-vpn --unlimited --networks internet-access-vpn + fi + + # create enrollment key for both networks + local netInetTag=$(nnmctl enrollment_key list | jq -r '.[] | .tags[0]' | grep -w "netmaker-inet") + if [[ ${netInetTag} = "" ]]; then + nmctl enrollment_key create --tags netmaker-inet --unlimited --networks netmaker,internet-access-vpn fi fi - # if [ "$INSTALL_TYPE" = "pro" ]; then - # local inetTag=$(nmctl enrollment_key list | jq -r '.[] | .tags[0]' | grep -w "internet-access-vpn") - # if [[ ${inetTag} = "internet-access-vpn" ]]; then - # # key exists already, fetch token - # InetTOKEN=$(nmctl enrollment_key list | jq -r '.[] | select(.tags[0]=="internet-access-vpn") | .token') - # else - # local tokenJson=$(nmctl enrollment_key create --tags internet-access-vpn --unlimited --networks internet-access-vpn) - # InetTOKEN=$(jq -r '.token' <<<${tokenJson}) - # if test -z "$InetTOKEN"; then - # echo "Error creating an enrollment key" - # exit 1 - # else - # echo "Enrollment key ready" - # fi - # fi - - # fi + if [ "$INSTALL_TYPE" = "pro" ]; then + # create enrollment key for both setup networks + echo "Obtaining enrollment key..." + # key exists already, fetch token + TOKEN=$(nmctl enrollment_key list | jq -r '.[] | select(.tags[0]=="netmaker-inet") | .token') + + else + + echo "Obtaining enrollment key..." + # key exists already, fetch token + TOKEN=$(nmctl enrollment_key list | jq -r '.[] | select(.tags[0]=="netmaker") | .token') + fi wait_seconds 3 From f5ff9b903dfd9c72d9f7d9636bf64264a1cf64f2 Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Mon, 7 Oct 2024 08:31:55 +0400 Subject: [PATCH 06/15] check if networks output is null --- scripts/nm-quick.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index b80ffb8f7..7f9a495cd 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -743,9 +743,11 @@ test_connection() { setup_mesh() { wait_seconds 5 - netmakerNet=$(nmctl network list -o json | jq -r '.[] | .netid' | grep -w "netmaker") - inetNet=$(nmctl network list -o json | jq -r '.[] | .netid' | grep -w "internet-access-vpn") - + networks=$(nmctl network list -o json) + if [[ ${networks} != "null" ]]; then + netmakerNet=$(nmctl network list -o json | jq -r '.[] | .netid' | grep -w "netmaker") + inetNet=$(nmctl network list -o json | jq -r '.[] | .netid' | grep -w "internet-access-vpn") + fi # create netmaker network if [[ ${netmakerNet} = "" ]]; then echo "Creating netmaker network (100.64.0.0/16)" From d5c24e372023526c756308c5877ba9cd7d62c49d Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Mon, 7 Oct 2024 08:33:22 +0400 Subject: [PATCH 07/15] fix nmctl typo --- scripts/nm-quick.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index 7f9a495cd..03464d2e5 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -779,7 +779,7 @@ setup_mesh() { fi # create enrollment key for both networks - local netInetTag=$(nnmctl enrollment_key list | jq -r '.[] | .tags[0]' | grep -w "netmaker-inet") + local netInetTag=$(nmctl enrollment_key list | jq -r '.[] | .tags[0]' | grep -w "netmaker-inet") if [[ ${netInetTag} = "" ]]; then nmctl enrollment_key create --tags netmaker-inet --unlimited --networks netmaker,internet-access-vpn fi From aab0c351e4c2e97f81d9dd572f4a4d6cbb3963d0 Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Mon, 7 Oct 2024 08:54:25 +0400 Subject: [PATCH 08/15] wait until two network are registered --- scripts/nm-quick.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index 03464d2e5..52b6e5188 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -127,7 +127,7 @@ setup_netclient() { ./netclient install echo "Register token: $TOKEN" sleep 2 - netclient register -t $TOKEN + netclient join -t $TOKEN echo "waiting for netclient to become available" local found=false @@ -135,13 +135,17 @@ setup_netclient() { for ((a = 1; a <= 90; a++)); do if [ -f "$file" ]; then found=true - break + # check if registered two nodes are present + l=$(jq length /etc/netclient/nodes.json) + if [ $l -ge 2 ];then + break + fi fi sleep 1 done if [ "$found" = false ]; then - echo "Error - $file not present" + echo "Error - $file state not matching" exit 1 fi } @@ -173,6 +177,8 @@ configure_netclient() { sleep 2 # create network for internet access vpn if [ "$INSTALL_TYPE" = "pro" ]; then + echo "HEREEE: ############" + cat /etc/netclient/nodes.json INET_NODE_ID=$(sudo cat /etc/netclient/nodes.json | jq -r .internet-access-vpn.id) nmctl node create_remote_access_gateway internet-access-vpn $INET_NODE_ID out=$(nmctl node list -o json | jq -r '.[] | select(.id=="$INET_NODE_ID") | .ingressdns = "8.8.8.8"') @@ -753,9 +759,6 @@ setup_mesh() { echo "Creating netmaker network (100.64.0.0/16)" # TODO causes "Error Status: 400 Response: {"Code":400,"Message":"could not find any records"}" nmctl network create --name netmaker --ipv4_addr 100.64.0.0/16 - - - wait_seconds 5 fi # create enrollment key for netmaker network local netmakerTag=$(nmctl enrollment_key list | jq -r '.[] | .tags[0]' | grep -w "netmaker") @@ -769,7 +772,6 @@ setup_mesh() { echo "Creating internet-access-vpn network (100.65.0.0/16)" # TODO causes "Error Status: 400 Response: {"Code":400,"Message":"could not find any records"}" nmctl network create --name internet-access-vpn --ipv4_addr 100.65.0.0/16 - wait_seconds 5 fi # create enrollment key for internet-access-vpn network From c045508725afcf02bccc28e64620755195a39578 Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Mon, 7 Oct 2024 09:26:38 +0400 Subject: [PATCH 09/15] fix jq parsing of inet network --- scripts/nm-quick.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index 52b6e5188..56b39173e 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -135,11 +135,6 @@ setup_netclient() { for ((a = 1; a <= 90; a++)); do if [ -f "$file" ]; then found=true - # check if registered two nodes are present - l=$(jq length /etc/netclient/nodes.json) - if [ $l -ge 2 ];then - break - fi fi sleep 1 done @@ -177,9 +172,7 @@ configure_netclient() { sleep 2 # create network for internet access vpn if [ "$INSTALL_TYPE" = "pro" ]; then - echo "HEREEE: ############" - cat /etc/netclient/nodes.json - INET_NODE_ID=$(sudo cat /etc/netclient/nodes.json | jq -r .internet-access-vpn.id) + INET_NODE_ID=$(sudo cat /etc/netclient/nodes.json | jq -r '."internet-access-vpn".id') nmctl node create_remote_access_gateway internet-access-vpn $INET_NODE_ID out=$(nmctl node list -o json | jq -r '.[] | select(.id=="$INET_NODE_ID") | .ingressdns = "8.8.8.8"') curl --location --request PUT "https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/internet-access-vpn/${INET_NODE_ID}" --data ${out} --header "Authorization: Bearer ${MASTER_KEY}" From f3cea1c8c993e941a6ade021c7b33cb27c503613 Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Mon, 7 Oct 2024 09:43:37 +0400 Subject: [PATCH 10/15] break loop --- scripts/nm-quick.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index 56b39173e..3e2b075d4 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -135,6 +135,7 @@ setup_netclient() { for ((a = 1; a <= 90; a++)); do if [ -f "$file" ]; then found=true + break fi sleep 1 done From 441c190d334a0ad367d48a7d79c9a7909a7b3b98 Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Mon, 7 Oct 2024 10:15:20 +0400 Subject: [PATCH 11/15] fix jq ingressdns parsing --- scripts/nm-quick.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index 3e2b075d4..f9eba7ca7 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -175,9 +175,9 @@ configure_netclient() { if [ "$INSTALL_TYPE" = "pro" ]; then INET_NODE_ID=$(sudo cat /etc/netclient/nodes.json | jq -r '."internet-access-vpn".id') nmctl node create_remote_access_gateway internet-access-vpn $INET_NODE_ID - out=$(nmctl node list -o json | jq -r '.[] | select(.id=="$INET_NODE_ID") | .ingressdns = "8.8.8.8"') + out=$(nmctl node list -o json | jq -r '.[] | select(.id=='\"$INET_NODE_ID\"') | .ingressdns = "8.8.8.8"') curl --location --request PUT "https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/internet-access-vpn/${INET_NODE_ID}" --data ${out} --header "Authorization: Bearer ${MASTER_KEY}" - curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/v1/nodes/internet-access-vpn/${INET_NODE_ID}/inet_gw" --data '{}' --header "Authorization: Bearer ${MASTER_KEY}" + curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/internet-access-vpn/${INET_NODE_ID}/inet_gw" --data '{}' --header "Authorization: Bearer ${MASTER_KEY}" fi set -e From 701584fcd3b028e81b786d50077923ff7acb26f7 Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Mon, 7 Oct 2024 10:35:10 +0400 Subject: [PATCH 12/15] fix ingress update dns --- scripts/nm-quick.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index f9eba7ca7..bf8a10302 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -176,7 +176,7 @@ configure_netclient() { INET_NODE_ID=$(sudo cat /etc/netclient/nodes.json | jq -r '."internet-access-vpn".id') nmctl node create_remote_access_gateway internet-access-vpn $INET_NODE_ID out=$(nmctl node list -o json | jq -r '.[] | select(.id=='\"$INET_NODE_ID\"') | .ingressdns = "8.8.8.8"') - curl --location --request PUT "https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/internet-access-vpn/${INET_NODE_ID}" --data ${out} --header "Authorization: Bearer ${MASTER_KEY}" + curl --location --request PUT "https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/internet-access-vpn/${INET_NODE_ID}" --data "$out" --header "Authorization: Bearer ${MASTER_KEY}" curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/internet-access-vpn/${INET_NODE_ID}/inet_gw" --data '{}' --header "Authorization: Bearer ${MASTER_KEY}" fi From 51eced8bf79c605cc57307235217017d65e072dc Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Mon, 7 Oct 2024 10:48:55 +0400 Subject: [PATCH 13/15] chane metadata for internet gw --- scripts/nm-quick.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index bf8a10302..ad22c0587 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -175,7 +175,7 @@ configure_netclient() { if [ "$INSTALL_TYPE" = "pro" ]; then INET_NODE_ID=$(sudo cat /etc/netclient/nodes.json | jq -r '."internet-access-vpn".id') nmctl node create_remote_access_gateway internet-access-vpn $INET_NODE_ID - out=$(nmctl node list -o json | jq -r '.[] | select(.id=='\"$INET_NODE_ID\"') | .ingressdns = "8.8.8.8"') + out=$(nmctl node list -o json | jq -r '.[] | select(.id=='\"$INET_NODE_ID\"') | .ingressdns = "8.8.8.8", .metadata ="This host can be used for secure internet access"') curl --location --request PUT "https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/internet-access-vpn/${INET_NODE_ID}" --data "$out" --header "Authorization: Bearer ${MASTER_KEY}" curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/internet-access-vpn/${INET_NODE_ID}/inet_gw" --data '{}' --header "Authorization: Bearer ${MASTER_KEY}" fi From 1e8ce1f9f7b0ac3bca32d616c3fe31193fa9b75b Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Mon, 7 Oct 2024 10:49:19 +0400 Subject: [PATCH 14/15] chane metadata for internet gw --- scripts/nm-quick.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index ad22c0587..902382291 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -175,7 +175,7 @@ configure_netclient() { if [ "$INSTALL_TYPE" = "pro" ]; then INET_NODE_ID=$(sudo cat /etc/netclient/nodes.json | jq -r '."internet-access-vpn".id') nmctl node create_remote_access_gateway internet-access-vpn $INET_NODE_ID - out=$(nmctl node list -o json | jq -r '.[] | select(.id=='\"$INET_NODE_ID\"') | .ingressdns = "8.8.8.8", .metadata ="This host can be used for secure internet access"') + out=$(nmctl node list -o json | jq -r '.[] | select(.id=='\"$INET_NODE_ID\"') | .ingressdns = "8.8.8.8", .metadata = "This host can be used for secure internet access"') curl --location --request PUT "https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/internet-access-vpn/${INET_NODE_ID}" --data "$out" --header "Authorization: Bearer ${MASTER_KEY}" curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/internet-access-vpn/${INET_NODE_ID}/inet_gw" --data '{}' --header "Authorization: Bearer ${MASTER_KEY}" fi From 961077f29dca9826e3173370a00bf996efebd8a9 Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Mon, 7 Oct 2024 16:06:20 +0400 Subject: [PATCH 15/15] update meta data field --- scripts/nm-quick.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index 902382291..5674b5ae4 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -175,7 +175,9 @@ configure_netclient() { if [ "$INSTALL_TYPE" = "pro" ]; then INET_NODE_ID=$(sudo cat /etc/netclient/nodes.json | jq -r '."internet-access-vpn".id') nmctl node create_remote_access_gateway internet-access-vpn $INET_NODE_ID - out=$(nmctl node list -o json | jq -r '.[] | select(.id=='\"$INET_NODE_ID\"') | .ingressdns = "8.8.8.8", .metadata = "This host can be used for secure internet access"') + out=$(nmctl node list -o json | jq -r '.[] | select(.id=='\"$INET_NODE_ID\"') | .ingressdns = "8.8.8.8"') + curl --location --request PUT "https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/internet-access-vpn/${INET_NODE_ID}" --data "$out" --header "Authorization: Bearer ${MASTER_KEY}" + out=$(nmctl node list -o json | jq -r '.[] | select(.id=='\"$INET_NODE_ID\"') | .metadata = "This host can be used for secure internet access"') curl --location --request PUT "https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/internet-access-vpn/${INET_NODE_ID}" --data "$out" --header "Authorization: Bearer ${MASTER_KEY}" curl --location --request POST "https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/internet-access-vpn/${INET_NODE_ID}/inet_gw" --data '{}' --header "Authorization: Bearer ${MASTER_KEY}" fi