-
Notifications
You must be signed in to change notification settings - Fork 2
/
wg-skoonie.sh
4649 lines (3736 loc) · 148 KB
/
wg-skoonie.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
#
# WireGuard Skoonie Wrapper servers as a wrapper for WireGuard, helping to simplify and automate
# many processes.
#
# This program creates and stores all of its configuraion files in the same directory that the
# main bash file wg-skoonie.sh is stored. Be sure to put the file in the appropriate directory.
#
# It helps with the following:
#
# > adding and removing interfaces by automatically handling necessary configuration files.
#
# > adding and removing devices
# > automatically determines the IP address of a new device by incrementing the highest IP address
# of pre-existing devices in the interfaces
# > automatically generating and deleting necessary configuration files
# > allows for devices to have names and descriptions associated with them.
# > auomatically generates the tunnel configuration file for the client device when a device is added.
#
# For a more comprehensive list of what this program can do, run "./wg-skoonie.sh --help
#
##--------------------------------------------------------------------------------------------------
# ::Global Variables
readonly PROGRAM_NAME="WireGuard Skoonie Wrapper"
readonly VERSION_NUMBER="1.2.2"
readonly SCRIPT_DIR=$(dirname "$(realpath "$0")")
readonly SCRIPT_ABS_FILE_PATH=$(realpath "$0")
readonly WG_SKOONIE_INTERFACES_FOLDER_PATH="${SCRIPT_DIR}/interfaces"
readonly WG_INTERFACES_FOLDER_PATH="/etc/wireguard"
declare -a deviceIpAddresses
declare -a devicePublicKeys
declare -a deviceNames
declare -a deviceDescriptions
declare -a deviceIpAddressesSorted
# end of ::Global Variables
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
# ::addDeviceToSkoonieFilesAndGenerateConfigFilesAndSetupScripts
#
# Adds a device to the skoonie configuration files, generates client configuration files, and
# generates setup scripts.
#
addDeviceToSkoonieFilesAndGenerateConfigFilesAndSetupScripts() {
local -n pNetworkValues=$1
addDeviceToSkoonieIniFile "${pNetworkValues["KEY_INTERFACE_INI_FILE_ABS_PATH"]}" "${pNetworkValues["KEY_NEW_DEVICE_IP_ADDRESS_DOTTED_DECIMAL"]}" "${pNetworkValues["KEY_NEW_DEVICE_PUBLIC_KEY"]}" "${pNetworkValues["KEY_NEW_DEVICE_NAME"]}" "${pNetworkValues["KEY_NEW_DEVICE_DESC"]}"
generateNewDeviceClientConfigFilesAndSetupScripts pNetworkValues
}
# end of ::addDeviceToSkoonieFilesAndGenerateConfigFilesAndSetupScripts
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
# ::addDeviceToWireGuard
#
# Attempts to add the new device found in pNetworkDetails to WireGuard.
#
# Parameters:
#
# $1 Reference to associative array key-value pair for network values. Will be modified.
#
# Return:
#
# Returns 0 upon success; 1 upon failure.
#
addDeviceToWireGuard() {
local -n pNetworkValues=$1
# Add device to WireGuard
addDeviceToWireGuardCmd='wg set '"${pNetworkValues["KEY_INTERFACE_NAME"]}"' peer '"${pNetworkValues["KEY_NEW_DEVICE_PUBLIC_KEY"]}"' allowed-ips "'"${pNetworkValues["KEY_NEW_DEVICE_IP_ADDRESS_DOTTED_DECIMAL"]}"'" 2>&1'
addDeviceWireGuardOutput=$(eval "${addDeviceToWireGuardCmd}")
# Save the config to file
wg-quick save ${pNetworkValues["KEY_INTERFACE_NAME"]}
listDevicesWireGuard=$(sudo wg)
echo "$listDevicesWireGuard" | grep -q "${pNetworkValues["KEY_NEW_DEVICE_IP_ADDRESS_DOTTED_DECIMAL"]}"
addToWireGuardWasSuccessful=$?
if [[ ${addToWireGuardWasSuccessful} != "0" ]] ; then
local errorMessage=" Failed to add device to WireGuard."
errorMessage+="\n\n Command used:"
errorMessage+="\n\n ${addDeviceToWireGuardCmd}"
errorMessage+="\n\n Output message from WireGuard after command: "
errorMessage+="\n\n ${addDeviceWireGuardOutput}"
logDeviceNotAddedSuccessfullyMessage "${errorMessage}"
return 1
fi
return 0
}
# end of ::addDeviceToWireGuard
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
# ::addDeviceToSkoonieIniFile
#
# Adds a new device to the skoonie ini file for the WireGuard interface.
#
# Parameters:
# $1 File path to skoonie ini file for the WireGuard interface.
# $2 IP address of new device.
# $3 New device public key.
# $4 Name of new device.
# $5 Description of new device.
#
addDeviceToSkoonieIniFile() {
local pSkoonieIniFilePath=$1
local pNewIpAddress=$2
local pNewDevicePublicKey=$3
local pNewDeviceName=$4
local pNewDeviceDescription=$5
cat << EOF >> $pSkoonieIniFilePath
[Device]
IP Address=${pNewIpAddress}
Public Key=${pNewDevicePublicKey}
Name=${pNewDeviceName}
Description=${pNewDeviceDescription}
EOF
}
# end of ::addDeviceToSkoonieIniFile
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
# ::addDevice
#
# Adds a new device to WireGuard and to the skoonieini files. The IP address is automatically
# calculated by incrementing the IP address of the highest IP address found in the skoonieini
# configuration file for the interface.
#
# $1 Interface name to add device to.
# $2 Name of new device.
# $3 Description of new device.
#
addDevice() {
local pInterfaceName=$1
local pNewDeviceName=$2
local pNewDeviceDescription=$3
local interfaceSkoonieIniFilePath="${WG_SKOONIE_INTERFACES_FOLDER_PATH}/${pInterfaceName}/${pInterfaceName}.skoonieini"
local statusGood=0
checkInterfaceValidity "${pInterfaceName}" "${interfaceSkoonieIniFilePath}"
statusGood=$?
# Return with error if status not good
if [[ "${statusGood}" -ne 0 ]] ; then
return 1
fi
local -A networkValues
networkValues["KEY_INTERFACE_NAME"]="${pInterfaceName}"
networkValues["KEY_INTERFACE_INI_FILE_ABS_PATH"]="${interfaceSkoonieIniFilePath}"
# Read existing devices on this interface from file
readInterfaceIniFile "$interfaceSkoonieIniFilePath" networkValues
# Determine the index of the next device (new device)
networkValues["KEY_NEW_DEVICE_INDEX"]=$(( ${#deviceIpAddresses[@]} ))
# Determine the most recent IP addrress used (might be server address)
local mostRecentIpAddressDottedDecimal
if [[ ${#deviceIpAddressesSorted[@]} -eq 0 ]]; then
mostRecentIpAddressDottedDecimal="${networkValues["KEY_SERVER_IP_ADDRESS_ON_VPN"]}"
else
mostRecentIpAddressDottedDecimal="${deviceIpAddressesSorted[-1]}"
fi
initializeNetworkValues "${pInterfaceName}" "${networkValues["KEY_SUBNET_MASK_CIDR_NOTATION"]}" "${networkValues["KEY_NETWORK_ADDRESS_DOTTED_DECIMAL"]}" "${mostRecentIpAddressDottedDecimal}" networkValues
# Calculate next consecutive IP address by adding 1 to the most recent IP address
local newDeviceIpAsInteger="$(( ${networkValues["KEY_MOST_RECENT_IP_ADDRESS_INTEGER"]}+1 ))"
# Stuff user input into network values
setNewDeviceValues "${newDeviceIpAsInteger}" "${pNewDeviceName}" "${pNewDeviceDescription}" networkValues
outputNetworkValuesToConsole networkValues
# Check if IP address is allowed
if [[ "${networkValues["KEY_NEW_DEVICE_IP_ADDRESS_IS_IN_SUBNET"]}" != "1" ]]
then
logDeviceNotAddedSuccessfullyMessage "${networkValues["KEY_NEW_DEVICE_IP_ADDRESS_IS_IN_SUBNET_MSG"]}"
return 1
fi
# Generate private and public keys for the new device
networkValues["KEY_NEW_DEVICE_PRIVATE_KEY"]=$(wg genkey)
networkValues["KEY_NEW_DEVICE_PUBLIC_KEY"]=$(echo "${networkValues["KEY_NEW_DEVICE_PRIVATE_KEY"]}" | wg pubkey)
addDeviceToWireGuard networkValues
statusGood=$?
# Return with error if status not good
if [[ "${statusGood}" -ne 0 ]] ; then
return 1
fi
addDeviceToSkoonieFilesAndGenerateConfigFilesAndSetupScripts networkValues
logDeviceAddedSuccessfullyMessage networkValues
}
# end of ::addDevice
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
# ::addDeviceSpecIp
#
# Adds a new device to WireGuard and to the skoonieini files with the specified IP address.
#
# $1 Interface name to add device to.
# $2 Specified IP address dotted-decimal format of new device.
# $3 Name of new device.
# $4 Description of new device.
#
addDeviceSpecIp() {
local pInterfaceName=$1
local pNewDeviceIpDottedDecimal=$2
local pNewDeviceName=$3
local pNewDeviceDescription=$4
local interfaceSkoonieIniFilePath="${WG_SKOONIE_INTERFACES_FOLDER_PATH}/${pInterfaceName}/${pInterfaceName}.skoonieini"
local statusGood=0
checkInterfaceValidity "${pInterfaceName}" "${interfaceSkoonieIniFilePath}"
statusGood=$?
# Return with error if status not good
if [[ "${statusGood}" -ne 0 ]] ; then
return 1
fi
local -A networkValues
networkValues["KEY_INTERFACE_NAME"]="${pInterfaceName}"
networkValues["KEY_INTERFACE_INI_FILE_ABS_PATH"]="${interfaceSkoonieIniFilePath}"
# Read existing devices on this interface from file
readInterfaceIniFile "$interfaceSkoonieIniFilePath" networkValues
# Determine the index of the next device (new device)
networkValues["KEY_NEW_DEVICE_INDEX"]=$(( ${#deviceIpAddresses[@]} + 1 ))
# Determine the most recent IP addrress used (might be server address)
local mostRecentIpAddressDottedDecimal
if [[ ${#deviceIpAddressesSorted[@]} -eq 0 ]]; then
mostRecentIpAddressDottedDecimal="${networkValues["KEY_SERVER_IP_ADDRESS_ON_VPN"]}"
else
mostRecentIpAddressDottedDecimal="${deviceIpAddressesSorted[-1]}"
fi
initializeNetworkValues "${pInterfaceName}" "${networkValues["KEY_SUBNET_MASK_CIDR_NOTATION"]}" "${networkValues["KEY_NETWORK_ADDRESS_DOTTED_DECIMAL"]}" "${mostRecentIpAddressDottedDecimal}" networkValues
# Convert user inputted IP address from dotted-decimal format to integer format
local newDeviceIpAsInteger="$(convertIpAddressDottedDecimalToInteger "${pNewDeviceIpDottedDecimal}")"
# Stuff user input into network values
setNewDeviceValues "${newDeviceIpAsInteger}" "${pNewDeviceName}" "${pNewDeviceDescription}" networkValues
outputNetworkValuesToConsole networkValues
# Check if IP address is allowed
if [[ "${networkValues["KEY_NEW_DEVICE_IP_ADDRESS_IS_IN_SUBNET"]}" != "1" ]]
then
logDeviceNotAddedSuccessfullyMessage "${networkValues["KEY_NEW_DEVICE_IP_ADDRESS_IS_IN_SUBNET_MSG"]}"
return 1
fi
# Generate private and public keys for the new device
networkValues["KEY_NEW_DEVICE_PRIVATE_KEY"]=$(wg genkey)
networkValues["KEY_NEW_DEVICE_PUBLIC_KEY"]=$(echo "${networkValues["KEY_NEW_DEVICE_PRIVATE_KEY"]}" | wg pubkey)
addDeviceToWireGuard networkValues
statusGood=$?
# Return with error if status not good
if [[ "${statusGood}" -ne 0 ]] ; then
return 1
fi
addDeviceToSkoonieFilesAndGenerateConfigFilesAndSetupScripts networkValues
logDeviceAddedSuccessfullyMessage networkValues
}
# end of ::addDeviceSpecIp
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
# ::addDeviceToSkoonieOnly
#
# Adds a new device to the skoonieini files but does not add the device to WireGuard. This is used
# when a device was previously added to WireGuard, but not added to the wireguard skoonie wrapper.
#
# Parameters:
#
# $1 Interface name.
# $2 New device public key.
# $3 New device IP address in dotted-decimal format.
# $4 New device name.
# $5 New device Description.
#
addDeviceToSkoonieOnly() {
local pInterfaceName=$1
local pNewDevicePublicKey=$2
local pNewDeviceIpDottedDecimal=$3
local pNewDeviceName=$4
local pNewDeviceDescription=$5
local interfaceSkoonieIniFilePath="${WG_SKOONIE_INTERFACES_FOLDER_PATH}/${pInterfaceName}/${pInterfaceName}.skoonieini"
local statusGood=0
checkInterfaceValidity "${pInterfaceName}" "${interfaceSkoonieIniFilePath}"
statusGood=$?
# Return with error if status not good
if [[ "${statusGood}" -ne 0 ]] ; then
return 1
fi
local -A networkValues
# Read existing devices on this interface from file
readInterfaceIniFile "$interfaceSkoonieIniFilePath" networkValues
# Determine the most recent IP addrress used
local mostRecentIpAddressInteger="${deviceIpAddressesSorted[-1]}"
initializeNetworkValues "${pInterfaceName}" "${networkValues["KEY_SUBNET_MASK_CIDR_NOTATION"]}" "${networkValues["KEY_NETWORK_ADDRESS_DOTTED_DECIMAL"]}" "${mostRecentIpAddressInteger}" networkValues
# Convert user inputted IP address from dotted-decimal format to integer format
local newDeviceIpAsInteger="$(convertIpAddressDottedDecimalToInteger "${pNewDeviceIpDottedDecimal}")"
# Stuff user input into network values
setNewDeviceValues "${newDeviceIpAsInteger}" "${pNewDeviceName}" "${pNewDeviceDescription}" networkValues
# Check if IP address is allowed
if [[ "${networkValues["KEY_NEW_DEVICE_IP_ADDRESS_IS_IN_SUBNET"]}" != "1" ]]
then
logDeviceNotAddedSuccessfullyMessage "${networkValues["KEY_NEW_DEVICE_IP_ADDRESS_IS_IN_SUBNET_MSG"]}"
return 1
fi
# Private key is not known since user only supplies public key. Not necessary anyways since
# client tunnel configuration file will not be generated
networkValues["KEY_NEW_DEVICE_PRIVATE_KEY"]=""
# Public key was provided by user
networkValues["KEY_NEW_DEVICE_PUBLIC_KEY"]="${pNewDevicePublicKey}"
addDeviceToSkoonieIniFile "$interfaceSkoonieIniFilePath" "${networkValues["KEY_NEW_DEVICE_IP_ADDRESS_DOTTED_DECIMAL"]}" "${networkValues["KEY_NEW_DEVICE_PUBLIC_KEY"]}" "${networkValues["KEY_NEW_DEVICE_NAME"]}" "${networkValues["KEY_NEW_DEVICE_DESC"]}"
logDeviceAddedToSkoonieOnlySuccessfullyMessage networkValues
}
# end of ::addDeviceToSkoonieOnly
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
# ::addInterface
#
# Adds a new interface to WireGuard and to the skoonieini files.
#
# $1 Name of interface to add.
# $2 Server endpoint (IP address or Domain Name with port).
# $3 Listening port.
# $4 Network address in dotted-decimal format.
# $5 Subnet mask in CIDR notation.
# $6 Server IP address on VPN.
#
addInterface() {
local pInterfaceName=$1
local pServerEndpoint=$2
local pListeningPort=$3
local pNetworkAddressDottedDecimal=$4
local pSubnetMaskAsCidrNotation=$5
local pServerIpAddress=$6
local sanitizedInterfaceName="${pInterfaceName// /-}"
local yellowFontColor="\033[33m"
local resetColors="\033[0m"
local interfaceSkoonieIniFilePath="${WG_SKOONIE_INTERFACES_FOLDER_PATH}/${sanitizedInterfaceName}/${sanitizedInterfaceName}.skoonieini"
mkdir -p "${WG_SKOONIE_INTERFACES_FOLDER_PATH}/${sanitizedInterfaceName}/"
# Generate the private key
local privateKey=$(wg genkey)
# Generate the public key from the private key
local publicKey=$(echo "${privateKey}" | wg pubkey)
# Save the private key to a file
echo "${privateKey}" > "${WG_INTERFACES_FOLDER_PATH}/${sanitizedInterfaceName}-private.key"
# Save the public key to a file
echo "${publicKey}" > "${WG_INTERFACES_FOLDER_PATH}/${sanitizedInterfaceName}-public.key"
# Removes any permissions on the file for users and groups other than the root
# user to ensure that only it can access the private key:
sudo chmod go= ${WG_INTERFACES_FOLDER_PATH}/${sanitizedInterfaceName}-private.key
local postUpCommands
# Add rule allowing all incoming traffic on the WireGuard interface from the network subnet
postUpCommands+="iptables -A INPUT -i ${pInterfaceName} -s ${pNetworkAddressDottedDecimal}/${pSubnetMaskAsCidrNotation} -j ACCEPT; "
# Add rule allowing all outgoing traffic on the WireGuard interface to the network subnet
postUpCommands+="iptables -A OUTPUT -o ${pInterfaceName} -d ${pNetworkAddressDottedDecimal}/${pSubnetMaskAsCidrNotation} -j ACCEPT; "
# Add rule forwarding all traffic from devices with IP address within the network
# subnet other devices within the network subnet on the WireGuard interface
postUpCommands+="iptables -A FORWARD -i ${pInterfaceName} -o ${pInterfaceName} -s ${pNetworkAddressDottedDecimal}/${pSubnetMaskAsCidrNotation} -d ${pNetworkAddressDottedDecimal}/${pSubnetMaskAsCidrNotation} -j ACCEPT; "
local postDownCommands
# Remove rule allowing all incoming traffic on the WireGuard interface from the network subnet
postDownCommands+="iptables -D INPUT -i ${pInterfaceName} -s ${pNetworkAddressDottedDecimal}/${pSubnetMaskAsCidrNotation} -j ACCEPT; "
# Remove rule allowing all outgoing traffic on the WireGuard interface to the network subnet
postDownCommands+="iptables -D OUTPUT -o ${pInterfaceName} -d ${pNetworkAddressDottedDecimal}/${pSubnetMaskAsCidrNotation} -j ACCEPT; "
# Remove rule forwarding all traffic from devices with IP address within the network
# subnet other devices within the network subnet on the WireGuard interface
postDownCommands+="iptables -D FORWARD -i ${pInterfaceName} -o ${pInterfaceName} -s ${pNetworkAddressDottedDecimal}/${pSubnetMaskAsCidrNotation} -d ${pNetworkAddressDottedDecimal}/${pSubnetMaskAsCidrNotation} -j ACCEPT; "
local interfaceDetails
interfaceDetails+="[Interface]"
interfaceDetails+="\n"
interfaceDetails+="PrivateKey = ${privateKey}"
interfaceDetails+="\n"
interfaceDetails+="Address = ${pServerIpAddress}/${pSubnetMaskAsCidrNotation}"
interfaceDetails+="\n"
interfaceDetails+="ListenPort = ${pListeningPort}"
interfaceDetails+="\n"
interfaceDetails+="PostUp = ${postUpCommands}"
interfaceDetails+="\n"
interfaceDetails+="PostDown = ${postDownCommands}"
interfaceDetails+="\n"
# Interface file should have SaveConfig set to false when first turning on the
# interface. This is because the interface sometimes has to be turned on and off
# a few times until it detects the config file. SaveConfig has to be set to false
# because if the interface is turned on while SaveConfig is true but the Interface
# failed to load settings from the config file, the config file will be overwritten
# with the blank details read in by WireGuard.
local interfaceFileOutputWithSaveConfigFalse="${interfaceDetails}"
interfaceFileOutputWithSaveConfigFalse+="SaveConfig = false"
echo -e "${interfaceFileOutputWithSaveConfigFalse}" > "${WG_INTERFACES_FOLDER_PATH}/${sanitizedInterfaceName}.conf"
# Allow traffic to specified port:
sudo ufw allow ${pListeningPort}/udp
# Enable wireguard interface to start on boot
sudo systemctl enable wg-quick@${sanitizedInterfaceName}.service
local errorStatus=1
for (( i=0; i<=10; i++ )); do
sudo wg-quick up ${pInterfaceName}
echo "wg-quick up attempt #${i}"
if sudo wg show ${pInterfaceName} 2>/dev/null | grep -q 'public key'; then
errorStatus=0
break
else
sudo wg-quick down ${pInterfaceName}
sleep 1
fi
done
if [[ "${errorStatus}" -ne 0 ]]
then
local msg
msg+="Failed to start interface."
msg+="\n"
msg+="\n"
msg+=" Please see above for details."
logErrorMessage "${msg}"
return 1
fi
# Resave interface file with SaveConfig set to true
sudo wg-quick down ${pInterfaceName}
local interfaceFileOutputWithSaveConfigFalse="${interfaceDetails}"
interfaceFileOutputWithSaveConfigFalse+="SaveConfig = true"
echo -e "${interfaceFileOutputWithSaveConfigFalse}" > "${WG_INTERFACES_FOLDER_PATH}/${sanitizedInterfaceName}.conf"
sudo wg-quick up ${pInterfaceName}
# initialize network values to be saved to file
local -A networkValues
networkValues["KEY_SERVER_ENDPOINT"]="${pServerEndpoint}"
networkValues["KEY_SERVER_LISTENING_PORT"]="${pListeningPort}"
networkValues["KEY_SERVER_PUBLIC_KEY"]="${publicKey}"
networkValues["KEY_SERVER_IP_ADDRESS_ON_VPN"]="${pServerIpAddress}"
networkValues["KEY_NETWORK_ADDRESS_DOTTED_DECIMAL"]="${pNetworkAddressDottedDecimal}"
networkValues["KEY_SUBNET_MASK_CIDR_NOTATION"]="${pSubnetMaskAsCidrNotation}"
# Output network details to skoonieini file
local skoonieIniFileOutput
skoonieIniFileOutput+=$(generateNetworkDetailsForSkoonieIniFile networkValues)
echo -e "${skoonieIniFileOutput}" > "${interfaceSkoonieIniFilePath}"
# Made it to here, which means we had success
local msg
msg+=" Interface '${sanitizedInterfaceName}' was added successfully."
msg+="\n"
msg+="\n"
msg+=" The interface configuration file for WireGuard was saved to:"
msg+="\n"
msg+="\n"
msg+=" ${yellowFontColor}${WG_INTERFACES_FOLDER_PATH}/${sanitizedInterfaceName}.conf${resetColors}"
msg+="\n"
msg+="\n"
msg+=" The public key for the server was saved to:"
msg+="\n"
msg+="\n"
msg+=" ${yellowFontColor}${WG_INTERFACES_FOLDER_PATH}/${sanitizedInterfaceName}-public.key${resetColors}"
msg+="\n"
msg+="\n"
msg+=" The private key for the server was saved to:"
msg+="\n"
msg+="\n"
msg+=" ${yellowFontColor}${WG_INTERFACES_FOLDER_PATH}/${sanitizedInterfaceName}-private.key${resetColors}"
msg+="\n"
msg+="\n"
msg+=" The interface configuration file for wg-skoonie was saved to:"
msg+="\n"
msg+="\n"
msg+=" ${yellowFontColor}${interfaceSkoonieIniFilePath}${resetColors}"
logSuccessMessage "${msg}"
}
# end of ::addInterface
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
# ::checkInterfaceValidity
#
# Determines if pInterfaceName is a valid interface in both WireGuard and the Skoonie WireGuard
# wrapper. Errors will be logged if it is not valid.
#
# Parameters:
#
# $1 Interface name to check for.
# $2 File path to interface skoonieini configuration file.
#
# Return:
#
# true if interface is valid in both WireGuard and Skoonie WireGuard wrapper; false otherwise.
#
checkInterfaceValidity() {
local pInterfaceName=$1
local pInterfaceSkoonieIniFilePath=$2
local yellowFontColor="\033[33m"
local resetColors="\033[0m"
statusGood=0
wg show "${pInterfaceName}" &> /dev/null
local interfaceExistsInWireGuard=$?
[ -e "${pInterfaceSkoonieIniFilePath}" ]
local interfaceSkoonieIniFileExists=$?
if [[ $interfaceExistsInWireGuard -ne 0 && $interfaceSkoonieIniFileExists -ne 0 ]]; then
local errorMsg=""
errorMsg+="Interface '${pInterfaceName}' cannot be found in WireGuard and the wg-skoonie skoonieini configuration file cannot be found."
errorMsg+="\n"
errorMsg+="\n File path used for skoonieini configruation file:"
errorMsg+="\n"
errorMsg+="\n ${yellowFontColor}${pInterfaceSkoonieIniFilePath}${resetColors}"
logErrorMessage "${errorMsg}"
statusGood=1
elif [[ $interfaceExistsInWireGuard -ne 0 ]]; then
logErrorMessage "Interface '${pInterfaceName}' cannot be found in WireGuard."
statusGood=1
elif [[ $interfaceSkoonieIniFileExists -ne 0 ]]; then
local errorMsg=""
errorMsg+="The wg-skoonie skoonieini configuration file cannot be found for interface '${pInterfaceName}'."
errorMsg+="\n"
errorMsg+="\n File path expected for skoonieini configruation file:"
errorMsg+="\n"
errorMsg+="\n ${yellowFontColor}${pInterfaceSkoonieIniFilePath}${resetColors}"
logErrorMessage "${errorMsg}"
statusGood=1
fi
return "${statusGood}"
}
# end of ::checkInterfaceValidity
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
# ::convertIpAddressDottedDecimalToInteger
#
# Converts the passed in IP address represented by the conventional dottted-decimal format to an
# integer.
#
# For example, 255.255.255.0 is converted to 4294967040.
#
# Parameters:
#
# $1 IP address represented by the conventional dottted-decimal format.
#
# Return:
#
# Returns the IP address represented as an integer.
#
convertIpAddressDottedDecimalToInteger() {
local ipAddressAsDottedDecimal=$1
local octets
IFS='.' read -r -a octets <<< "$ipAddressAsDottedDecimal"
resultsInteger=$(( (${octets[0]} << 24) | (${octets[1]} << 16) | (${octets[2]} << 8) | (${octets[3]}) ))
echo $resultsInteger
}
# end of ::convertIpAddressDottedDecimalToInteger
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
# ::convertIpAddressIntegerToPadded32BitBinaryString
#
# Converts the passed in IP address represented by an integer to binary format in a string. The
# binary expression is padded with 0s to be a full 32 bits.
#
# For example:
# 4294967040 converted to 11111111111111111111111100000000
# 184549120 converted to 00001010111111111111111100000000
#
# Parameters:
#
# $1 IP address represented as an integer.
#
# Return:
#
# Returns the IP address represented as a 32-bit binary value in a string.
#
convertIpAddressIntegerToPadded32BitBinaryString() {
local ipAddressAsInteger=$1
# Desired width of the binary number with padding
local width=32
# Create string with thirty-two 0s
local zerosPadding=$(printf '%0*d' $width)
binary=$(echo "obase=2; $ipAddressAsInteger" | bc)
binaryWithPadding=$(echo "${zerosPadding:0:$width-${#binary}}$binary")
echo $binaryWithPadding
}
# end of ::convertIpAddressIntegerToPaddedBinaryString
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
# ::convertIpAddressIntegerToDottedDecimalString
#
# Converts the passed in IP address represented by an integer to the conventional dottted-decimal
# string.
#
# For example, 4294967040 is converted to 255.255.255.0.
#
# Parameters:
#
# $1 IP address represented as an integer.
#
# Return:
#
# Returns the IP address represented as the conventional dottted-decimal format in a string.
#
convertIpAddressIntegerToDottedDecimalString() {
local ipAddressAsInteger=$1
local -a stringArray
for (( i=0; i<=3; i++ )); do
local bitshift=$(( ${i} * 8 ))
local octet=$(( (ipAddressAsInteger >> ${bitshift}) & 0xFF ))
stringArray+=("${octet}")
done
resultsString="${stringArray[3]}.${stringArray[2]}.${stringArray[1]}.${stringArray[0]}"
echo $resultsString
}
# end of ::convertIpAddressIntegerToDottedDecimalString
##--------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
# ::convertSubnetMaskCidrToSubnetMaskDottedDecimal
#
# Converts the passed in subnet mask in CIDR notation to the equivalent subnet mask in
# dotted-decimal notation.
#
# For example:
# IP Address & CIDR CIDR Subnet Mask IP Addresses Ranges
# 10.255.255.0/24 24 255.255.255.0 10.255.255.0 to 10.255.255.255
# 10.255.255.0/22 24 255.255.252.0 10.255.252.0 to 10.255.255.255
#
# Note that IP addresses 10.255.255.0 (lowest) and 10.255.255.255 (highest) values are typically
# reserved for special functions.
#
# Parameters:
#
# $1 Subnet mask in CIDR notation to convert to the equivalent subnet mask in dotted-decimal
# notation.
#
# Return:
#
# Returns the dotted-decimal subnet mask derived from the passed in CIDR dotted-decimal.
#
convertCidrToSubnetMask() {
local cidr=$1
# Calculate the number of network bits
local network_bits=$(( 32 - cidr ))
# Create a bitmask with the leftmost n bits set to 1
local bitmask=$(( (1 << network_bits) - 1 ))
# Convert the bitmask to dotted-decimal notation
local octet1=$(( bitmask >> 24 & 255 ))
local octet2=$(( bitmask >> 16 & 255 ))
local octet3=$(( bitmask >> 8 & 255 ))
local octet4=$(( bitmask & 255 ))
# Print the subnet mask
echo "$(( 255 - octet1 )).$(( 255 - octet2 )).$(( 255 - octet3 )).$(( 255 - octet4 ))"
}
# end of ::convertCidrToSubnetMask
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
# ::generateNewDeviceClientConfigFilesAndSetupScripts
#
# Generates the client configuration files and setup scripts for different operating systems.
#
# Parameters:
#
# $1 Reference to associative array key-value pair for network values.
#
generateNewDeviceClientConfigFilesAndSetupScripts() {
local -n pNetworkValues786=$1
pNetworkValues786["KEY_NEW_DEVICE_CLIENT_CONFIG_FILES_FOLDER"]="${WG_SKOONIE_INTERFACES_FOLDER_PATH}/${pNetworkValues786["KEY_INTERFACE_NAME"]}/device${pNetworkValues786["KEY_NEW_DEVICE_INDEX"]}"
generateNewDeviceConfigFileAndSetupScriptForRaspbian pNetworkValues786
generateNewDeviceConfigFileAndSetupScriptForUbuntuLessThanV17_10 pNetworkValues786
generateNewDeviceConfigFileAndSetupScriptForUbuntuGreaterThanOrEqualToV17_10 pNetworkValues786
generateNewDeviceConfigFileForWindows pNetworkValues786
generateNewDeviceConfigFileForPhone pNetworkValues786
}
# end of ::generateNewDeviceClientConfigFilesAndSetupScripts
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
# ::generateNewDeviceConfigFileAndSetupScriptForRaspbian
#
# Generates the client configuration file using the passed in parameters for a machine running
# Raspbian.
#
# Raspbian is still using the traditional ipdownup network management tools.
#
# Parameters:
#
# $1 Reference to associative array key-value pair for network values.
#
# Return:
#
# Upon return, the client configuration file will be saved to:
#
# [Folder]/[WireGuard Interface Name]/device[Device Index]/Raspbian/[WireGuard Interface Name].conf
#
# For example: /etc/wireguard/wg0/device0/Raspbian/wg0.conf
#
# Upon return, the setup script will be saved to:
#
# [Folder]/[WireGuard Interface Name]/device[Device Index]/Raspbian/[WireGuard Interface Name]-setup.sh
#
# For example: /etc/wireguard/wg0/device0/Raspbian/wg0-setup.conf
#
# Upon return, the connecitivity connector script meant to be run as a cronjob will be saved to:
#
# [Folder]/[WireGuard Interface Name]/device[Device Index]/Raspbian/wg-skoonie-cronjob-[WireGuard Interface Name].sh
#
# For example: /etc/wireguard/wg0/device0/Raspbian/wg-skoonie-cronjob-wg0.conf
#
generateNewDeviceConfigFileAndSetupScriptForRaspbian() {
local -n pNetworkValues825=$1
local folderPath="${pNetworkValues825["KEY_NEW_DEVICE_CLIENT_CONFIG_FILES_FOLDER"]}/Raspbian"
local configFilePath="${folderPath}/${pNetworkValues825["KEY_INTERFACE_NAME"]}.conf"
local setupScriptFilePath="${folderPath}/${pNetworkValues825["KEY_INTERFACE_NAME"]}-setup.sh"
local connectivityScriptFilePath="${folderPath}/wg-skoonie-cronjob-${pNetworkValues825["KEY_INTERFACE_NAME"]}.sh"
pNetworkValues825["KEY_NEW_DEVICE_CLIENT_CONFIG_RASPBIAN_FILE_PATH"]="${configFilePath}"
pNetworkValues825["KEY_NEW_DEVICE_CLIENT_RASPBIAN_SETUP_SCRIPT_FILE_PATH"]="${setupScriptFilePath}"
pNetworkValues825["KEY_NEW_DEVICE_CLIENT_RASPBIAN_CONNECTIVITY_CHECKER_SCRIPT_FILE_PATH"]="${connectivityScriptFilePath}"
mkdir -p "${folderPath}"
generateNewDeviceConfigFileForTraditionalifupdown "${pNetworkValues825["KEY_NEW_DEVICE_CLIENT_CONFIG_RASPBIAN_FILE_PATH"]}" pNetworkValues825
generateNewDeviceSetupScriptForTraditionalifupdown "${pNetworkValues825["KEY_NEW_DEVICE_CLIENT_RASPBIAN_SETUP_SCRIPT_FILE_PATH"]}" pNetworkValues825
generateNewDeviceConnectivityCheckerScriptForTraditionalifupdown "${pNetworkValues825["KEY_NEW_DEVICE_CLIENT_RASPBIAN_CONNECTIVITY_CHECKER_SCRIPT_FILE_PATH"]}" pNetworkValues825
pNetworkValues825["KEY_NEW_DEVICE_CLIENT_CONFIG_RASPBIAN_FILE_ABS_PATH"]=$(realpath "${pNetworkValues825["KEY_NEW_DEVICE_CLIENT_CONFIG_RASPBIAN_FILE_PATH"]}")
pNetworkValues825["KEY_NEW_DEVICE_CLIENT_RASPBIAN_SETUP_SCRIPT_FILE_ABS_PATH"]=$(realpath "${pNetworkValues825["KEY_NEW_DEVICE_CLIENT_RASPBIAN_SETUP_SCRIPT_FILE_PATH"]}")
pNetworkValues825["KEY_NEW_DEVICE_CLIENT_RASPBIAN_CONNECTIVITY_CHECKER_SCRIPT_FILE_ABS_PATH"]=$(realpath "${pNetworkValues825["KEY_NEW_DEVICE_CLIENT_RASPBIAN_CONNECTIVITY_CHECKER_SCRIPT_FILE_PATH"]}")
}
# end of ::generateNewDeviceConfigFileAndSetupScriptForRaspbian
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
# ::generateNewDeviceConfigFileAndSetupScriptForUbuntuLessThanV17_10
#
# Generates the client configuration file using the passed in parameters for a machine running
# an Ubuntu distribution with a version less than 17.10.
#
#
# Parameters:
#
# $1 Reference to associative array key-value pair for network values.
#
# Return:
#
# Upon return, the client configuration file will be saved to:
#
# [Folder]/[WireGuard Interface Name]/device[Device Index]/Ubuntu-lt-17_10/[WireGuard Interface Name].conf
#
# For example: /etc/wireguard/wg0/device0/Ubuntu-lt-V17_10/wg0.conf
#
# Upon return, the setup script will be saved to:
#
# [Folder]/[WireGuard Interface Name]/device[Device Index]/Ubuntu-lt-17_10/[WireGuard Interface Name]-setup.sh
#
# For example: /etc/wireguard/wg0/device0/Ubuntu-lt-V17_10/wg0-setup.conf
#
# Upon return, the connecitivity connector script meant to be run as a cronjob will be saved to:
#
# [Folder]/[WireGuard Interface Name]/device[Device Index]/Ubuntu-lt-17_10/wg-skoonie-cronjob-[WireGuard Interface Name].sh
#
# For example: /etc/wireguard/wg0/device0/Ubuntu-lt-17_10/wg-skoonie-cronjob-wg0.conf
#
generateNewDeviceConfigFileAndSetupScriptForUbuntuLessThanV17_10() {
local -n pNetworkValues1170=$1
local folderPath="${pNetworkValues1170["KEY_NEW_DEVICE_CLIENT_CONFIG_FILES_FOLDER"]}/Ubuntu-lt-V17_10"
local configFilePath="${folderPath}/${pNetworkValues1170["KEY_INTERFACE_NAME"]}.conf"
local scriptFilePath="${folderPath}/${pNetworkValues1170["KEY_INTERFACE_NAME"]}-setup.sh"
local connectivityScriptFilePath="${folderPath}/wg-skoonie-cronjob-${pNetworkValues1170["KEY_INTERFACE_NAME"]}.sh"
pNetworkValues1170["KEY_NEW_DEVICE_CLIENT_CONFIG_UBUNTU_LT_17-10_FILE_PATH"]="${configFilePath}"
pNetworkValues1170["KEY_NEW_DEVICE_CLIENT_UBUNTU_LT_17-10_SETUP_SCRIPT_FILE_PATH"]="${scriptFilePath}"
pNetworkValues1170["KEY_NEW_DEVICE_CLIENT_UBUNTU_LT_17-10_CONNECTIVITY_CHECKER_SCRIPT_FILE_PATH"]="${connectivityScriptFilePath}"
mkdir -p "$folderPath"
generateNewDeviceConfigFileForTraditionalifupdown "${pNetworkValues1170["KEY_NEW_DEVICE_CLIENT_CONFIG_UBUNTU_LT_17-10_FILE_PATH"]}" pNetworkValues1170
generateNewDeviceSetupScriptForTraditionalifupdown "${pNetworkValues1170["KEY_NEW_DEVICE_CLIENT_UBUNTU_LT_17-10_SETUP_SCRIPT_FILE_PATH"]}" pNetworkValues1170
generateNewDeviceConnectivityCheckerScriptForTraditionalifupdown "${pNetworkValues1170["KEY_NEW_DEVICE_CLIENT_UBUNTU_LT_17-10_CONNECTIVITY_CHECKER_SCRIPT_FILE_PATH"]}" pNetworkValues1170
pNetworkValues1170["KEY_NEW_DEVICE_CLIENT_CONFIG_UBUNTU_LT_17-10_FILE_ABS_PATH"]=$(realpath "${pNetworkValues1170["KEY_NEW_DEVICE_CLIENT_CONFIG_UBUNTU_LT_17-10_FILE_PATH"]}")
pNetworkValues1170["KEY_NEW_DEVICE_CLIENT_UBUNTU_LT_17-10_SETUP_SCRIPT_FILE_ABS_PATH"]=$(realpath "${pNetworkValues1170["KEY_NEW_DEVICE_CLIENT_UBUNTU_LT_17-10_SETUP_SCRIPT_FILE_PATH"]}")
pNetworkValues1170["KEY_NEW_DEVICE_CLIENT_UBUNTU_LT_17-10_CONNECTIVITY_CHECKER_SCRIPT_FILE_ABS_PATH"]=$(realpath "${pNetworkValues1170["KEY_NEW_DEVICE_CLIENT_UBUNTU_LT_17-10_CONNECTIVITY_CHECKER_SCRIPT_FILE_PATH"]}")
}
# end of ::generateNewDeviceConfigFileAndSetupScriptForUbuntuLessThanV17_10
##--------------------------------------------------------------------------------------------------
##--------------------------------------------------------------------------------------------------
# ::generateNewDeviceConfigFileAndSetupScriptForUbuntuGreaterThanOrEqualToV17_10
#
# Generates the client configuration file using the passed in parameters for a machine running
# an Ubuntu distribution with a version greater than or equal to 17.10.
#
# Ubuntu started using Netplan network management tools in version 17.10.
#
# Parameters:
#
# $1 Reference to associative array key-value pair for network values.
#
# Return:
#
# Upon return, the client configuration file will be saved to:
#
# [Folder]/[WireGuard Interface Name]/device[Device Index]/Ubuntu-gte-17_10/[WireGuard Interface Name].conf
#
# For example: /etc/wireguard/wg0/device0/Ubuntu-gte-V17_10/wg0.conf
#
# Upon return, the setup script will be saved to:
#
# [Folder]/[WireGuard Interface Name]/device[Device Index]/Ubuntu-gte-17_10/[WireGuard Interface Name]-setup.sh
#
# For example: /etc/wireguard/wg0/device0/Ubuntu-gte-V17_10/wg0-setup.conf
#
# Upon return, the connecitivity connector script meant to be run as a cronjob will be saved to:
#
# [Folder]/[WireGuard Interface Name]/device[Device Index]/Ubuntu-gte-17_10/wg-skoonie-cronjob-[WireGuard Interface Name].sh
#
# For example: /etc/wireguard/wg0/device0/Ubuntu-gte-17_10/wg-skoonie-cronjob-wg0.conf
#
generateNewDeviceConfigFileAndSetupScriptForUbuntuGreaterThanOrEqualToV17_10() {
local -n pNetworkValues925=$1
local folderPath="${pNetworkValues925["KEY_NEW_DEVICE_CLIENT_CONFIG_FILES_FOLDER"]}/Ubuntu-gte-V17_10"
local configFilePath="${folderPath}/${pNetworkValues925["KEY_INTERFACE_NAME"]}.conf"
local scriptFilePath="${folderPath}/${pNetworkValues925["KEY_INTERFACE_NAME"]}-setup.sh"
local connectivityScriptFilePath="${folderPath}/wg-skoonie-cronjob-${pNetworkValues925["KEY_INTERFACE_NAME"]}.sh"
pNetworkValues925["KEY_NEW_DEVICE_CLIENT_CONFIG_UBUNTU_GTE_17-10_FILE_PATH"]="${configFilePath}"
pNetworkValues925["KEY_NEW_DEVICE_CLIENT_UBUNTU_GTE_17-10_SETUP_SCRIPT_FILE_PATH"]="${scriptFilePath}"
pNetworkValues925["KEY_NEW_DEVICE_CLIENT_UBUNTU_GTE_17-10_CONNECTIVITY_CHECKER_SCRIPT_FILE_PATH"]="${connectivityScriptFilePath}"
mkdir -p "$folderPath"
generateNewDeviceConfigFileForNetplan "${pNetworkValues925["KEY_NEW_DEVICE_CLIENT_CONFIG_UBUNTU_GTE_17-10_FILE_PATH"]}" pNetworkValues925
generateNewDeviceSetupScriptForNetplan "${pNetworkValues925["KEY_NEW_DEVICE_CLIENT_UBUNTU_GTE_17-10_SETUP_SCRIPT_FILE_PATH"]}" pNetworkValues925
generateNewDeviceConnectivityCheckerScriptForNetplan "${pNetworkValues925["KEY_NEW_DEVICE_CLIENT_UBUNTU_GTE_17-10_CONNECTIVITY_CHECKER_SCRIPT_FILE_PATH"]}" pNetworkValues925