Skip to content

Commit 0c4ed8f

Browse files
authored
Merge pull request sonic-net#62 from gechiang/ghc-202205
[bgp]: Add sudo check for TSA/B/C command execution (sonic-net#15288)
2 parents afa2423 + 5a1abf2 commit 0c4ed8f

File tree

3 files changed

+22
-4
lines changed
  • dockers/docker-fpm-frr/base_image_files

3 files changed

+22
-4
lines changed

dockers/docker-fpm-frr/base_image_files/TSA

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
#!/bin/bash
22

3+
# Restrict command to sudo users
4+
if [ "$EUID" -ne 0 ] ; then
5+
echo "Root priveleges are needed for this operation"
6+
exit 1
7+
fi
8+
39
if [ -f /etc/sonic/chassisdb.conf ]; then
4-
rexec all -c "TSA chassis"
10+
rexec all -c "sudo TSA chassis"
511
echo "Please execute \"rexec all -c 'sudo config save -y'\" to preserve System mode in Maintenance after reboot\
612
or config reload on all linecards"
713
exit 0

dockers/docker-fpm-frr/base_image_files/TSB

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
#!/bin/bash
22

3+
# Restrict command to sudo users
4+
if [ "$EUID" -ne 0 ] ; then
5+
echo "Root priveleges are needed for this operation"
6+
exit 1
7+
fi
8+
39
# If run on supervisor of chassis, trigger remote execution of TSB on all linecards
410
if [ -f /etc/sonic/chassisdb.conf ]; then
5-
rexec all -c "TSB chassis"
11+
rexec all -c "sudo TSB chassis"
612
echo "Please execute \"rexec all -c 'sudo config save -y'\" to preserve System mode in Normal state after reboot\
713
or config reload on all linecards"
814
exit 0

dockers/docker-fpm-frr/base_image_files/TSC

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
#!/bin/bash
22

3+
# Restrict command to sudo users
4+
if [ "$EUID" -ne 0 ] ; then
5+
echo "Root priveleges are needed for this operation"
6+
exit 1
7+
fi
8+
39
if [ -f /etc/sonic/chassisdb.conf ]; then
410
if [[ $1 == "no-stats" ]]; then
5-
rexec all -c "TSC no-stats"
11+
rexec all -c "sudo TSC no-stats"
612
else
7-
rexec all -c "TSC"
13+
rexec all -c "sudo TSC"
814
fi
915
exit 0
1016
fi

0 commit comments

Comments
 (0)