bastille icon indicating copy to clipboard operation
bastille copied to clipboard

Ifconfig cannot find interface after upgrade from 0.8.x to 0.9.x

Open mikaelmoutakis opened this issue 3 years ago • 4 comments

Hi! I upgraded my bastille version from ports from 0.8.20210115 to 0.9.20211225

When I try to create a jail ifconfig it failes with the following error message

root@nas /u/l/e/bastille# bastille create -V azkaban 13.0-RELEASE 192.168.1.50/24 jail1
Valid: (192.168.1.50/24).
Valid: (jail1).

[azkaban]:
azkaban: created
ifconfig: interface e0b_bastille1 does not exist
jail: azkaban: /sbin/ifconfig e0b_bastille1 vnet azkaban: failed
azkaban: removed

The loopback interface defined in /usr/local/etc/bastille/bastille.conf is the default bastille0:

root@nas /u/l/e/bastille# grep bastille_network bastille.conf
bastille_network_loopback="bastille0"                                 ## default: "bastille0"
bastille_network_shared=""                                            ## default: ""
bastille_network_gateway="192.168.1.1"                                           ## default: ""
bastille_network_gateway6=""                                          ## default: ""

The interfaces I have on my jail host with a bastille-name are:

e0a_bastille0
e0a_bastille1
e0a_bastille10
e0a_bastille11
e0a_bastille12
e0a_bastille13
e0a_bastille14
e0a_bastille15
e0a_bastille16
e0a_bastille17
e0a_bastille18
e0a_bastille2
e0a_bastille3
e0a_bastille4
e0a_bastille5
e0a_bastille6
e0a_bastille8
e0a_bastille9

mikaelmoutakis avatar Feb 05 '22 18:02 mikaelmoutakis

Hello,

If you want to use the the loopback interface bastille0 you have to remove the -V option which is for making VNET jails. As for why the error "ifconfig: interface e0b_bastille1 does not exist" I do not know.

adriel-tech avatar Feb 05 '22 19:02 adriel-tech

Hello,

I have the same problem, but I want to use VNET jails.

# bastille create -V azkaban 13.0-RELEASE 0.0.0.0 igb0
Valid: (0.0.0.0).
Valid: (igb0).

[azkaban]:
azkaban: created
ifconfig: interface e0b_bastille1 does not exist
jail: azkaban: /sbin/ifconfig e0b_bastille1 vnet azkaban: failed
azkaban: removed

The epair interfaces on my host are:

e0a_bastille0 
e0a_bastille1

I think here is some kind of hiccup, as the new azkaban should use e0a_bastille2 .

EDIT: I just got some time and looked into the code. This is a bug in release 0.9.20211225 (I checked on FreeBSD 13.0).

The function generate_vnet_jail_conf() in /usr/local/share/bastille/create.sh:187 tries grep the current epair number using:

if ! grep -q "e${_num}b" "${bastille_jailsdir}"/*/jail.conf; then

However, this does not work properly. In the current master branch the function has been moved to common.sh and this issue has been fixed. Now the epair is checked with:

if ! grep -q "e[0-9]b_bastille${_num}" "${bastille_jailsdir}"/*/jail.conf; then

I replaced the if condition and this fixed the issue. Hope I didn't break anything else. To be clear: this issue will be fixed with the next release.

gschwepp avatar Feb 16 '22 21:02 gschwepp

This looks related to the regression that was discovered in the 0.9.20211225 release. It has been fixed in GitHub and available in the 0.9.20220216 release now.

Please verify the new release resolves the issue.

cedwards avatar Feb 21 '22 15:02 cedwards

@mikaelmoutakis did you check with the new version as suggested ?

yaazkal avatar Mar 23 '22 01:03 yaazkal

resolved per 0.9.20220216 release

bmac2 avatar Oct 19 '23 02:10 bmac2