/usr/lib/x86_64-linux-gnu/firejail/fshaper.sh is in firejail 0.9.52-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #!/bin/bash
usage() {
echo "Usage:"
echo " fshaper.sh --status"
echo " fshaper.sh --clear device"
echo " fshaper.sh --set device download-speed upload-speed"
}
if [ "$1" = "--status" ]; then
/sbin/tc -s qdisc ls
/sbin/tc -s class ls
exit
fi
if [ "$1" = "--clear" ]; then
if [ $# -ne 2 ]; then
echo "Error: invalid command"
usage
exit
fi
DEV=$2
echo "Removing bandwith limits"
/sbin/tc qdisc del dev $DEV root 2> /dev/null > /dev/null
/sbin/tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null
exit
fi
if [ "$1" = "--set" ]; then
DEV=$2
echo "Removing bandwith limit"
/sbin/tc qdisc del dev $DEV ingress #2> /dev/null > /dev/null
if [ $# -ne 4 ]; then
echo "Error: missing parameters"
usage
exit
fi
DEV=$2
echo "Configuring interface $DEV "
IN=$3
IN=$((${IN} * 8))
echo "Download speed ${IN}kbps"
OUT=$4
OUT=$((${OUT} * 8))
echo "Upload speed ${OUT}kbps"
echo "cleaning limits"
/sbin/tc qdisc del dev $DEV root 2> /dev/null > /dev/null
/sbin/tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null
echo "configuring tc ingress"
/sbin/tc qdisc add dev $DEV handle ffff: ingress #2> /dev/null > /dev/null
/sbin/tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \
0.0.0.0/0 police rate ${IN}kbit burst 10k drop flowid :1 #2> /dev/null > /dev/null
echo "configuring tc egress"
/sbin/tc qdisc add dev $DEV root tbf rate ${OUT}kbit latency 25ms burst 10k #2> /dev/null > /dev/null
exit
fi
echo "Error: missing parameters"
usage
exit 1
|