Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default value for bastille_network_pf_table is ignored[BUG] #681

Open
voh9eepah opened this issue Feb 19, 2024 · 6 comments
Open

Default value for bastille_network_pf_table is ignored[BUG] #681

voh9eepah opened this issue Feb 19, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@voh9eepah
Copy link

[MANDATORY] Describe the bug [MANDATORY]
When variable bastille_network_pf_table is not initialized in bastille.conf, then default value jails is not used.

[MANDATORY] Bastille and FreeBSD version (paste bastille -v && freebsd-version -kru output)
0.10.20231125
13.2-RELEASE-p10
13.2-RELEASE-p10
13.2-RELEASE-p10

[MANDATORY] How did you install bastille? (port/pkg/git)
pkg

[optional] Steps to reproduce?

  1. From bastille.conf comment out the line
    bastille_network_pf_table="jails" ## default: "jails"
  2. Start the jail:
    bastille start svelte
    This gives output:
    pfctl: Invalid argument. [svelte]: svelte: created
  3. Output from
    pfctl -t jails -T show
    is empty.

[optional] Expected behavior
The output of the command bastille start .. must not give a warning from pfctl and table jails should not be empty.

[optional] Screenshots
If applicable, add screenshots to help explain your problem.

[optional] Additional context
Add any other context about the problem here.

@voh9eepah voh9eepah added the bug Something isn't working label Feb 19, 2024
@tschettervictor
Copy link
Collaborator

This can probably be closed. @bmac2

The default value is mentioned because "bastille.conf" sets if for you. By commenting out that line you are essentially removing the default value.

@voh9eepah
Copy link
Author

I just did not comment out that line. That line was missing from my bastille.conf because that file was created before commit dd7f195. That commit made the pf table name and external interface configurable.

I thought the default value for bastille_network_pf_table was set in /usr/local/bin/bastille?

@tschettervictor
Copy link
Collaborator

tschettervictor commented Dec 9, 2024

Ah I see what you are saying.

I think there were some issues regarding the pf setup that have since been resolved by adding those lines.

As far as what you are saying

# Set default values for config properties added during the current major version:
: "${bastille_network_pf_ext_if:=ext_if}"
: "${bastille_network_pf_table:=jails}"

These lines should do that. They are found in /usr/local/bin/bastille. Can you try the following and see if that sets them by default?

# Set default values for config properties added during the current major version:
bastille_network_pf_ext_if="${bastille_network_pf_ext_if:=ext_if}"
bastille_network_pf_table="${bastille_network_pf_table:=jails}"

@voh9eepah
Copy link
Author

The syntax that is used in /usr/local/bin/bastille seems to work fine.

My guess is that the problem is not how the default value for variable bastille_network_pf_table is set, but that the subscripts do not see a value for that variable set in /usr/local/bin/bastille.

For example, if bastille_network_pf_table is not set in bastille.conf and I set the default value for this variable in /usr/local/share/bastille/start.sh, then starting the jail works fine.

I set the bastille_network_pf_table default in start.sh with the same syntax as used in /usr/local/bin/bastille:

. /usr/local/etc/bastille/bastille.conf
: "${bastille_network_pf_table:=jails}"

@tschettervictor
Copy link
Collaborator

I suppose it could be that /usr/local/bin/bastille is not sourced by the start.sh file.

I'm not really sure.

@tschettervictor
Copy link
Collaborator

I think it would be best to simply define it inside "common.sh" and have all the other files source it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants