Ability to remove docker0 from setup-interfaces
Package Information
- Package name: ??? setup-interfaces (/sbin/setup-interfaces)
- Package version: latest available with Alpine Linux 3.19
- Alpine version: 3.19.1
- Alpine architecture: x86_64
Summary
When you have docker installed on Alpine Linux and want to give the user the ability to change the IP address of the appliance, you get prompted with a default of docker0 interface. Generally, probably not a good idea to have this available in this way.
Solution included.
Steps to reproduce
install docker then run /sbin/setup-interfaces
To correct I modified two functions:
from:
unconfigured_get_first() {
ls *.noconf 2>/dev/null | head -n 1 | sed 's/.noconf//'
}
to:
unconfigured_get_first() {
ls *.noconf 2>/dev/null | grep -v 'docker0.noconf' | head -n 1 | sed 's/.noconf//'
}
--and--
from:
unconfigured_list() {
local list= i=
for i in *.noconf; do
[ -e "$i" ] || continue
list="${list} ${i%.noconf}"
done
echo $list
}
to:
unconfigured_list() {
local list=
for i in *.noconf; do
[ -e "$i" ] || continue
# Exclude docker0 from the list
if [ "$i" != "docker0.noconf" ]; then
list="${list} ${i%.noconf}"
fi
done
echo $list
}
This will prevent enumeration of docker0, and will not find it as the "first" interface
Edited by officialh1