-
Notifications
You must be signed in to change notification settings - Fork 11
/
ethpillar.sh
executable file
·1345 lines (1268 loc) · 41.3 KB
/
ethpillar.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
# Author: coincashew.eth | coincashew.com
# License: GNU GPL
# Source: https://github.com/coincashew/ethpillar
# Description: EthPillar is a one-liner setup tool and node management TUI
#
# Made for home and solo stakers 🏠🥩
# 🫶 Make improvements and suggestions on GitHub:
# * https://github.com/coincashew/ethpillar
# 🙌 Ask questions on Discord:
# * https://discord.gg/dEpAVWgFNB
EP_VERSION="3.1.4"
# Default text editor
EDITOR="nano"
# VARIABLES
export BASE_DIR="$HOME/git/ethpillar" && cd $BASE_DIR
# Load functions
source ./functions.sh
# Load environment variables, Lido CSM withdrawal address and fee recipient
source ./env
# Load environment variables overrides
[[ -f ./.env.overrides ]] && source ./.env.overrides
# Consensus client or beacon node HTTP Endpoint
export API_BN_ENDPOINT="http://${CL_IP_ADDRESS}:${CL_REST_PORT}"
# Execution layer RPC API
export EL_RPC_ENDPOINT="${EL_IP_ADDRESS}:${EL_RPC_PORT}"
# Get machine info
_platform=$(get_platform)
_arch=$(get_arch)
menuMain(){
# Define the options for the main menu
OPTIONS=(
1 "View Logs (Exit: CTRL+B D)"
- ""
)
test -f /etc/systemd/system/execution.service && OPTIONS+=(2 "Execution Client")
test -f /etc/systemd/system/consensus.service && OPTIONS+=(3 "Consensus Client")
test -f /etc/systemd/system/validator.service && OPTIONS+=(4 "Validator Client")
test -f /etc/systemd/system/mevboost.service && OPTIONS+=(5 "MEV-Boost")
test -f /etc/systemd/system/csm_nimbusvalidator.service && OPTIONS+=(6 "CSM Nimbus Validator Plugin")
OPTIONS+=(
- ""
10 "Start all clients"
11 "Stop all clients"
12 "Restart all clients"
- ""
20 "System Administration"
21 "Toolbox"
22 "Plugins"
99 "Quit"
)
while true; do
getBackTitle
# Display the main menu and get the user's choice
CHOICE=$(whiptail --clear --cancel-button "Quit"\
--backtitle "$BACKTITLE" \
--title "EthPillar $EP_VERSION | $NODE_MODE" \
--menu "Choose a category:" \
0 42 0 \
"${OPTIONS[@]}" \
3>&1 1>&2 2>&3)
if [ $? -gt 0 ]; then # user pressed <Cancel> button
break
fi
# Handle the user's choice
case $CHOICE in
1)
runScript view_logs.sh
;;
2)
submenuExecution
;;
3)
submenuConsensus
;;
4)
submenuValidator
;;
5)
submenuMEV-Boost
;;
6)
submenuPluginCSMValidator
;;
10)
test -f /etc/systemd/system/execution.service && sudo service execution start
test -f /etc/systemd/system/consensus.service && sudo service consensus start
test -f /etc/systemd/system/validator.service && sudo service validator start
test -f /etc/systemd/system/mevboost.service && sudo service mevboost start
test -f /etc/systemd/system/csm_nimbusvalidator.service && sudo service csm_nimbusvalidator start
;;
11)
test -f /etc/systemd/system/execution.service && sudo service execution stop
test -f /etc/systemd/system/consensus.service && sudo service consensus stop
test -f /etc/systemd/system/validator.service && sudo service validator stop
test -f /etc/systemd/system/mevboost.service && sudo service mevboost stop
test -f /etc/systemd/system/csm_nimbusvalidator.service && sudo service csm_nimbusvalidator stop
;;
12)
test -f /etc/systemd/system/execution.service && sudo service execution restart
test -f /etc/systemd/system/consensus.service && sudo service consensus restart
test -f /etc/systemd/system/validator.service && sudo service validator restart
test -f /etc/systemd/system/mevboost.service && sudo service mevboost restart
test -f /etc/systemd/system/csm_nimbusvalidator.service && sudo service csm_nimbusvalidator restart
;;
20)
submenuAdminstrative
;;
21)
submenuTools
;;
22)
submenuPlugins
;;
99)
break
;;
esac
done
}
submenuExecution(){
while true; do
getBackTitle
# Define the options for the submenu
SUBOPTIONS=(
1 "View logs"
2 "Start execution"
3 "Stop execution"
4 "Restart execution"
5 "Edit configuration"
6 "Update to latest release"
7 "Resync execution client"
8 "Expose execution client RPC Port"
- ""
9 "Back to main menu"
)
# Display the submenu and get the user's choice
SUBCHOICE=$(whiptail --clear --cancel-button "Back" \
--backtitle "$BACKTITLE" \
--title "Execution Client" \
--menu "Choose one of the following options:" \
0 0 0 \
"${SUBOPTIONS[@]}" \
3>&1 1>&2 2>&3)
if [ $? -gt 0 ]; then # user pressed <Cancel> button
break
fi
# Handle the user's choice from the submenu
case $SUBCHOICE in
1)
sudo bash -c 'journalctl -fu execution | ccze -A'
;;
2)
sudo service execution start
;;
3)
sudo service execution stop
;;
4)
sudo service execution restart
;;
5)
sudo "${EDITOR}" /etc/systemd/system/execution.service
if whiptail --title "Reload daemon and restart services" --yesno "Do you want to restart execution client?" 8 78; then
sudo systemctl daemon-reload && sudo service execution restart
fi
;;
6)
runScript update_execution.sh
;;
7)
runScript resync_execution.sh
;;
8)
exposeRpcEL
;;
9)
break
;;
esac
done
}
submenuConsensus(){
while true; do
getBackTitle
# Define the options for the submenu
SUBOPTIONS=(
1 "View logs"
2 "Start consensus"
3 "Stop consensus"
4 "Restart consensus"
5 "Edit configuration"
6 "Update to latest release"
7 "Resync consensus client"
8 "Expose consensus client RPC Port"
- ""
9 "Back to main menu"
)
# Display the submenu and get the user's choice
SUBCHOICE=$(whiptail --clear --cancel-button "Back" \
--backtitle "$BACKTITLE" \
--title "Consensus Client" \
--menu "Choose one of the following options:" \
0 0 0 \
"${SUBOPTIONS[@]}" \
3>&1 1>&2 2>&3)
if [ $? -gt 0 ]; then # user pressed <Cancel> button
break
fi
# Handle the user's choice from the submenu
case $SUBCHOICE in
1)
sudo bash -c 'journalctl -fu consensus | ccze -A'
;;
2)
sudo service consensus start
;;
3)
sudo service consensus stop
;;
4)
sudo service consensus restart
;;
5)
sudo "${EDITOR}" /etc/systemd/system/consensus.service
if whiptail --title "Reload daemon and restart services" --yesno "Do you want to restart consensus client?" 8 78; then
sudo systemctl daemon-reload && sudo service consensus restart
fi
;;
6)
runScript update_consensus.sh
;;
7)
runScript resync_consensus.sh
;;
8)
exposeRpcCL
;;
9)
break
;;
esac
done
}
submenuValidator(){
while true; do
getBackTitle
# Define the options for the submenu
SUBOPTIONS=(
1 "View logs"
2 "Start validator"
3 "Stop validator"
4 "Restart validator"
5 "Edit configuration"
)
[[ ${NODE_MODE} =~ "Validator Client Only" ]] && SUBOPTIONS+=(6 "Update to latest release")
SUBOPTIONS+=(
- ""
10 "Generate / Import Validator Keys"
11 "View validator pubkeys and indices"
- ""
12 "Generate Voluntary Exit Messages (VEM)"
13 "Broadcast Voluntary Exit Messages (VEM)"
14 "Next withdrawal: See expected time, blocks to go"
15 "Check validator status, balance"
16 "Check validator entry/exit queue with beaconcha.in"
17 "Attestation Performance: Obtain information about attester inclusion"
- ""
99 "Back to main menu"
)
# Display the submenu and get the user's choice
SUBCHOICE=$(whiptail --clear --cancel-button "Back" \
--backtitle "$BACKTITLE" \
--title "Validator" \
--menu "Choose one of the following options:" \
0 0 0 \
"${SUBOPTIONS[@]}" \
3>&1 1>&2 2>&3)
if [ $? -gt 0 ]; then # user pressed <Cancel> button
break
fi
# Handle the user's choice from the submenu
case $SUBCHOICE in
1)
sudo bash -c 'journalctl -fu validator | ccze -A'
;;
2)
sudo service validator start
;;
3)
sudo service validator stop
;;
4)
sudo service validator restart
;;
5)
sudo "${EDITOR}" /etc/systemd/system/validator.service
if whiptail --title "Reload daemon and restart services" --yesno "Do you want to restart validator?" 8 78; then
sudo systemctl daemon-reload && sudo service validator restart
fi
;;
6)
runScript update_consensus.sh
;;
10)
runScript manage_validator_keys.sh
;;
11)
getPubKeys && getIndices
viewPubkeyAndIndices
;;
12)
installEthdo
generateVoluntaryExitMessage
;;
13)
installEthdo
broadcastVoluntaryExitMessageLocally
;;
14)
installEthdo
ethdoNextWithdrawalSweep
;;
15)
installEthdo
checkValidatorStatus
;;
16)
checkValidatorQueue
;;
17)
installEthdo
checkValidatorAttestationInclusion
;;
99)
break
;;
esac
done
}
submenuMEV-Boost(){
while true; do
getBackTitle
# Define the options for the submenu
SUBOPTIONS=(
1 "View logs"
2 "Start MEV-Boost"
3 "Stop MEV-Boost"
4 "Restart MEV-Boost"
5 "Edit configuration"
6 "Update to latest release"
7 "Check relay registration"
8 "Check relay latency"
- ""
9 "Back to main menu"
)
# Display the submenu and get the user's choice
SUBCHOICE=$(whiptail --clear --cancel-button "Back" \
--backtitle "$BACKTITLE" \
--title "MEV-Boost" \
--menu "Choose one of the following options:" \
0 0 0 \
"${SUBOPTIONS[@]}" \
3>&1 1>&2 2>&3)
if [ $? -gt 0 ]; then # user pressed <Cancel> button
break
fi
# Handle the user's choice from the submenu
case $SUBCHOICE in
1)
sudo bash -c 'journalctl -fu mevboost | ccze -A'
;;
2)
sudo service mevboost start
;;
3)
sudo service mevboost stop
;;
4)
sudo service mevboost restart
;;
5)
sudo "${EDITOR}" /etc/systemd/system/mevboost.service
if whiptail --title "Reload daemon and restart services" --yesno "Do you want to restart MEV-Boost" 8 78; then
sudo systemctl daemon-reload && sudo service mevboost restart
fi
;;
6)
runScript update_mevboost.sh
;;
7)
checkRelayRegistration
;;
8)
checkRelayLatency
;;
9)
break
;;
esac
done
}
submenuAdminstrative(){
while true; do
getBackTitle
# Define the options for the submenu
SUBOPTIONS=(
1 "Update system"
2 "Restart system"
3 "Shutdown system"
- ""
4 "View software versions"
5 "View cpu/ram/disk/net (btop)"
6 "View general node information"
- ""
10 "Update EthPillar"
11 "About EthPillar"
- ""
20 "Configure autostart"
21 "Uninstall node"
22 "Reinstall node: Change installation type, network"
23 "Override environment variables"
- ""
99 "Back to main menu"
)
# Display the submenu and get the user's choice
SUBCHOICE=$(whiptail --clear --cancel-button "Back" \
--backtitle "$BACKTITLE" \
--title "System Administration" \
--menu "Choose one of the following options:" \
0 0 0 \
"${SUBOPTIONS[@]}" \
3>&1 1>&2 2>&3)
if [ $? -gt 0 ]; then # user pressed <Cancel> button
break
fi
# Handle the user's choice from the submenu
case $SUBCHOICE in
1)
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
;;
2)
if whiptail --title "Reboot" --defaultno --yesno "Are you sure you want to reboot?" 8 78; then sudo reboot now; fi
;;
3)
if whiptail --title "Shutdown" --defaultno --yesno "Are you sure you want to shutdown?" 8 78; then sudo shutdown now; fi
;;
4)
test -f /etc/systemd/system/validator.service && getClient && getCurrentVersion && VC="Validator client: $CLIENT $VERSION"
test -f /etc/systemd/system/consensus.service && CL=$(curl -s -X GET "${API_BN_ENDPOINT}/eth/v1/node/version" -H "accept: application/json" | jq -r '.data.version')
test -f /etc/systemd/system/execution.service && EL=$(curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":2}' ${EL_RPC_ENDPOINT} | jq -r '.result')
MB=$(if [[ -f /etc/systemd/system/mevboost.service ]]; then printf "Mev-boost: $(mev-boost --version 2>&1 | sed 's/.*\s\([0-9]*\.[0-9]*\).*/\1/')"; else printf "Mev-boost: Not Installed"; fi)
if [[ -z $CL ]] ; then
CL="Not installed or still starting up."
fi
if [[ -z $EL ]] ; then
EL="Not installed or still starting up."
fi
whiptail --title "Installed versions" --msgbox "Consensus client: ${CL}\nExecution client: ${EL}\n${VC}\n${MB}" 10 78
;;
5)
# Install btop process monitoring
if ! command -v btop &> /dev/null; then
sudo apt-get install btop -y
fi
btop
;;
6)
print_node_info
;;
10)
cd $BASE_DIR ; git fetch origin main ; git checkout main ; git pull --ff-only ; git reset --hard ; git clean -xdf
whiptail --title "Updated EthPillar" --msgbox "Restart EthPillar for latest version." 10 78
;;
11)
MSG_ABOUT="🫰 Created as a Public Good by CoinCashew.eth since Pre-Genesis 2020
\n🫶 Make improvements and suggestions on GitHub: https://github.com/coincashew/ethpillar
\n🙌 Ask questions on Discord: https://discord.gg/dEpAVWgFNB
\nIf you'd like to support this public goods project, find us on the next Gitcoin Grants.
\nOur donation address is 0xCF83d0c22dd54475cC0C52721B0ef07d9756E8C0 or coincashew.eth"
whiptail --title "About EthPillar" --msgbox "$MSG_ABOUT" 20 78
;;
20)
configureAutoStart
;;
21)
runScript uninstall.sh
;;
22)
if whiptail --title "Reinstall EthPillar" --defaultno --yesno "Are you sure you want to reinstall?\nAll current node data will be removed." 9 78; then
if runScript uninstall.sh; then
installNode
whiptail --title "Reinstall complete" --msgbox "Completed node reinstall process." 8 78
fi
fi
;;
23)
if [[ ! -f ${BASE_DIR}/.env.overrides ]]; then
# Create from template
cp .env.overrides.example .env.overrides
fi
"${EDITOR}" .env.overrides
# Reload environment variables overrides
[[ -f ./.env.overrides ]] && source ./.env.overrides
;;
99)
break
;;
esac
done
}
submenuMonitoring(){
while true; do
getNetworkConfig
getBackTitle
# Define the options for the submenu
SUBOPTIONS=(
1 "View Logs"
2 "Start Monitoring"
3 "Stop Monitoring"
4 "Restart Monitoring"
5 "Edit configuration"
6 "Edit Prometheus.yml configuration"
7 "Update to latest release"
8 "Uninstall monitoring"
9 "Configure alerting with Grafana"
- ""
10 "Back to main menu"
)
# Display the submenu and get the user's choice
SUBCHOICE=$(whiptail --clear --cancel-button "Back" \
--backtitle "$BACKTITLE" \
--title "Monitoring - Ethereum Metrics Exporter" \
--menu "\nAccess Grafana at: http://127.0.0.1:3000 or http://$ip_current:3000\n\nChoose one of the following options:" \
0 0 0 \
"${SUBOPTIONS[@]}" \
3>&1 1>&2 2>&3)
if [ $? -gt 0 ]; then # user pressed <Cancel> button
break
fi
# Handle the user's choice from the submenu
case $SUBCHOICE in
1)
sudo bash -c 'journalctl -fu grafana-server -fu prometheus -fu ethereum-metrics-exporter -fu prometheus-node-exporter -n 100 | ccze -A'
;;
2)
sudo systemctl start grafana-server prometheus ethereum-metrics-exporter prometheus-node-exporter
;;
3)
sudo systemctl stop grafana-server prometheus ethereum-metrics-exporter prometheus-node-exporter
;;
4)
sudo systemctl restart grafana-server prometheus ethereum-metrics-exporter prometheus-node-exporter
;;
5)
sudo "${EDITOR}" /etc/systemd/system/ethereum-metrics-exporter.service
if whiptail --title "Reload daemon and restart services" --yesno "Do you want to restart ethereum metrics exporter?" 8 78; then
sudo systemctl daemon-reload && sudo service ethereum-metrics-exporter restart
fi
;;
6)
sudo "${EDITOR}" /etc/prometheus/prometheus.yml
if whiptail --title "Restart services" --yesno "Do you want to restart prometheus?" 8 78; then
sudo service prometheus restart
fi
;;
7)
runScript ethereum-metrics-exporter.sh -u
;;
8)
runScript ethereum-metrics-exporter.sh -r
;;
9)
whiptail --title "Configure Alerting with Grafana" --msgbox "Grafana enables users to create custom alert systems that notify them via multiple channels, including email, messaging apps like Telegram and Discord.
\nWith the default install, basic alerts for CPU/DISK/RAM are configured.
\nTo receive these alerts:
\n- Navigate to Grafana in your web browser
\n- Click Alerting (the alert bell icon) on the left-hand side menu
\n- Create contact points and notification policies" 20 78
;;
10)
break
;;
esac
done
}
submenuEthduties(){
while true; do
getBackTitle
# Define the options for the submenu
SUBOPTIONS=(
1 "View duties"
2 "Wait for 90.0% of attestation duties to be executed in 90 sec. or later"
3 "Update to latest release"
4 "Uninstall eth-duties"
- ""
9 "Back to main menu"
)
# Display the submenu and get the user's choice
SUBCHOICE=$(whiptail --clear --cancel-button "Back" \
--backtitle "$BACKTITLE" \
--title "eth-duties" \
--menu "Choose one of the following options:" \
0 0 0 \
"${SUBOPTIONS[@]}" \
3>&1 1>&2 2>&3)
if [ $? -gt 0 ]; then # user pressed <Cancel> button
break
fi
# Handle the user's choice from the submenu
case $SUBCHOICE in
1)
getNetwork && getPubKeys && getIndices
if [[ ${#INDICES[@]} = "0" ]]; then echo "No validators currently active. Once validators are activated, you can query duties."; sleep 5;
return; fi
/usr/local/bin/eth-duties --validators ${INDICES[@]} --beacon-nodes $API_BN_ENDPOINT
;;
2)
getNetwork && getPubKeys && getIndices
if [[ ${#INDICES[@]} = "0" ]]; then echo "No validators currently active. Once validators are activated, you can query duties."; sleep 5;
return; fi
/usr/local/bin/eth-duties --validators ${INDICES[@]} --beacon-nodes $API_BN_ENDPOINT --max-attestation-duty-logs 60 --mode cicd-wait --mode-cicd-attestation-time 90 --mode-cicd-attestation-proportion 0.90
ohai "Ready! Press ENTER to continue."
read
;;
3)
runScript eth-duties.sh -u
;;
4)
runScript eth-duties.sh -r
;;
9)
break
;;
esac
done
}
submenuEthdo(){
while true; do
getBackTitle
# Define the options for the submenu
SUBOPTIONS=(
1 "Status: Check validator status, balance"
2 "VEM: Generate Voluntary Exit Messages"
3 "VEM: Broadcast Voluntary Exit Messages"
4 "Next withdrawal: See expected time, blocks to go"
5 "Earnings: Show expected yield (APY)"
6 "Next duties: Show expected time between block proposals, sync comm"
7 "Credentials: Show withdrawal address"
8 "Attestation Performance: Obtain information about attester inclusion"
9 "Update to latest release"
10 "Uninstall ethdo"
- ""
99 "Back to main menu"
)
# Display the submenu and get the user's choice
SUBCHOICE=$(whiptail --clear --cancel-button "Back" \
--backtitle "$BACKTITLE" \
--title "ethdo" \
--menu "Choose one of the following options:" \
0 0 0 \
"${SUBOPTIONS[@]}" \
3>&1 1>&2 2>&3)
if [ $? -gt 0 ]; then # user pressed <Cancel> button
break
fi
# Handle the user's choice from the submenu
case $SUBCHOICE in
1)
checkValidatorStatus
;;
2)
generateVoluntaryExitMessage
;;
3)
broadcastVoluntaryExitMessageLocally
;;
4)
ethdoNextWithdrawalSweep
;;
5)
ethdoYield
;;
6)
ethdoExpectation
;;
7)
ethdoWithdrawalAddress
;;
8)
checkValidatorAttestationInclusion
;;
9)
runScript ethdo.sh -u
;;
10)
runScript ethdo.sh -r
;;
99)
break
;;
esac
done
}
submenuUFW(){
while true; do
getBackTitle
getNetworkConfig
# Define the options for the submenu
SUBOPTIONS=(
1 "View ufw status"
2 "Allow incoming traffic on a port"
3 "Deny incoming traffic on a port"
4 "Delete a rule"
- ""
5 "Enable firewall with default settings"
6 "EC RPC Node: Allow local network access to RPC port 8545"
7 "CC RPC Node: Allow local network access to RPC port 5052"
8 "Monitoring: Allow local network access to Grafana port 3000"
9 "Disable firewall"
10 "Reset firewall rules: Delete all rules"
- ""
11 "Whitelist an IP address: Allow full access to this node"
- ""
99 "Back to main menu"
)
# Display the submenu and get the user's choice
SUBCHOICE=$(whiptail --clear --cancel-button "Back" \
--backtitle "$BACKTITLE" \
--title "UFW Firewall" \
--menu "Choose one of the following options:" \
0 0 0 \
"${SUBOPTIONS[@]}" \
3>&1 1>&2 2>&3)
if [ $? -gt 0 ]; then # user pressed <Cancel> button
break
fi
# Handle the user's choice from the submenu
case $SUBCHOICE in
1)
sudo ufw status numbered
ohai "Press ENTER to continue."
read
;;
2)
read -p "Enter the port number to allow: " port_number
sudo ufw allow $port_number
ohai "Port allowed."
sleep 2
;;
3)
read -p "Enter the port number to deny: " port_number
sudo ufw deny $port_number
ohai "Port denied."
sleep 2
;;
4)
sudo ufw status numbered
read -p "Enter the rule number to delete: " rule_number
sudo ufw delete $rule_number
ohai "Rule deleted."
sleep 2
;;
5)
# Default ufw settings
sudo ufw default deny incoming
sudo ufw default allow outgoing
echo "${tty_bold}Allow SSH access? [y|n]${tty_reset}"
read -rsn1 yn
if [[ ${yn} = [Yy]* ]]; then
read -r -p "Enter your SSH port. Press Enter to use default '22': " _ssh_port
_ssh_port=${_ssh_port:-22}
sudo ufw allow ${_ssh_port}/tcp comment 'Allow SSH port'
fi
sudo ufw allow 30303 comment 'Allow execution client port'
sudo ufw allow 9000 comment 'Allow consensus client port'
sudo ufw enable
sudo ufw status numbered
ohai "UFW firewall enabled."
sleep 3
;;
6)
sudo ufw allow from ${network_current} to any port 8545 comment 'Allow local network to access execution client RPC port'
ohai "Local network ${network_current} can access RPC port 8545"
sleep 2
;;
7)
sudo ufw allow from ${network_current} to any port 5052 comment 'Allow local network to access consensus client RPC port'
ohai "Local network ${network_current} can access RPC port 5052"
sleep 2
;;
8)
sudo ufw allow from ${network_current} to any port 3000 comment 'Allow local network to access Grafana'
ohai "Local network ${network_current} can access RPC port 3000"
sleep 2
;;
9)
sudo ufw disable
ohai "UFW firewall disabled."
sleep 2
;;
10)
sudo ufw disable
sudo ufw --force reset
ohai "UFW firewall reset."
sleep 2
;;
11)
read -p "Enter the IP address to whitelist: " ip_whitelist
sudo ufw allow from $ip_whitelist
ohai "IP address whitelisted."
sleep 2
;;
99)
break
;;
esac
done
}
submenuPluginSentinel(){
while true; do
getNetworkConfig
getBackTitle
# Define the options for the submenu
SUBOPTIONS=(
1 "View Logs"
2 "Start sentinel"
3 "Stop sentinel"
4 "Restart sentinel"
5 "Edit .env configuration"
6 "Update to latest release"
7 "Uninstall plugin"
- ""
10 "Back to main menu"
)
# Display the submenu and get the user's choice
SUBCHOICE=$(whiptail --clear --cancel-button "Back" \
--backtitle "$BACKTITLE" \
--title "Plugin - CSM Sentinel" \
--menu "\nGet private notifications for your CSM Node Operator ID on Telegram\nConnect with your bot at t.me/[YOUR-BOT-NAME] and initiate service by typing /start" \
0 0 0 \
"${SUBOPTIONS[@]}" \
3>&1 1>&2 2>&3)
if [ $? -gt 0 ]; then # user pressed <Cancel> button
break
fi
# Handle the user's choice from the submenu
case $SUBCHOICE in
1)
sudo bash -c 'docker logs csm-sentinel -f -n 300 | ccze -A'
ohai "Press ENTER to exit logs."
read
;;
2)
sudo docker start csm-sentinel
;;
3)
sudo docker stop csm-sentinel
;;
4)
sudo docker restart csm-sentinel
;;
5)
sudo "${EDITOR}" /opt/ethpillar/plugin-sentinel/csm-sentinel/.env
if whiptail --title "Reload env and restart services" --yesno "Do you want to restart with updated env?" 8 78; then
sudo docker stop csm-sentinel
runScript plugins/sentinel/plugin_csm_sentinel.sh -s
sudo docker start csm-sentinel
fi
;;
6)
runScript plugins/sentinel/plugin_csm_sentinel.sh -u
;;
7)
runScript plugins/sentinel/plugin_csm_sentinel.sh -r
;;
10)
break
;;
esac
done
}
submenuPluginCSMValidator(){
while true; do
getBackTitle
# Define the options for the submenu
SUBOPTIONS=(
1 "View logs"
2 "Start validator"
3 "Stop validator"
4 "Restart validator"
5 "Edit configuration"
6 "Edit environment file"
7 "Update to latest release"
- ""
10 "Generate Validator Keys: Make a new secret recovery phrase"
11 "Import Validator Keys: From offline key generation or backup"
12 "Add/Restore Validator Keys: From secret recovery phrase"
13 "View validator pubkeys and indices"
- ""
20 "Generate Voluntary Exit Messages (VEM)"
21 "Broadcast Voluntary Exit Messages (VEM)"
22 "Next withdrawal: See expected time, blocks to go"
23 "Check validator status, balance"
24 "Check validator entry/exit queue with beaconcha.in"
25 "Attestation Performance: Obtain information about attester inclusion"
- ""
42 "Uninstall plugin"
- ""
99 "Back to main menu"
)
# Display the submenu and get the user's choice
SUBCHOICE=$(whiptail --clear --cancel-button "Back" \
--backtitle "$BACKTITLE" \
--title "Plugin - Separate Lido CSM Validator" \
--menu "Choose one of the following options:" \
0 0 0 \
"${SUBOPTIONS[@]}" \
3>&1 1>&2 2>&3)
if [ $? -gt 0 ]; then # user pressed <Cancel> button
break
fi
# Handle the user's choice from the submenu
case $SUBCHOICE in
1)
sudo bash -c 'journalctl -fu csm_nimbusvalidator | ccze -A'
;;
2)
sudo service csm_nimbusvalidator start
;;
3)
sudo service csm_nimbusvalidator stop
;;
4)
sudo service csm_nimbusvalidator restart
;;
5)
sudo "${EDITOR}" /etc/systemd/system/csm_nimbusvalidator.service
if whiptail --title "Reload daemon and restart services" --yesno "Do you want to restart validator?" 8 78; then
sudo systemctl daemon-reload && sudo service csm_nimbusvalidator restart
fi