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

Sending wrong argument to jexec in jcreate.subr #197

Closed
sweco-secfha opened this issue Oct 3, 2017 · 5 comments
Assignees

Comments

@sweco-secfha
Copy link

@sweco-secfha sweco-secfha commented Oct 3, 2017

In jcreate.subr all executions of jexec looks like jexec jname=$jname but jexec expects jexec $jname so I had to modify jcreate.subr to work.
I'm on FreeBSD 11.1.

@olevole olevole self-assigned this Oct 3, 2017
@olevole

This comment has been minimized.

Copy link
Collaborator

@olevole olevole commented Oct 3, 2017

Oops, it seems that this bug appeared in one of the latest versions of the CBSD, when I added PATH before post/hook's jexec.

jexec jname=$jname

This is correct execution for ~cbsd/jailctl/jexec script, not for system /usr/sbin/jexec

Each script with #!/usr/local/bin/cbsd shebang trying to execute script from CBSD hier first via custom PATH. But in latest releases I've back PATH to system for some reason.

Correct way to fix is add '/usr/local/bin/cbsd' before jexec in this place, due to 'cbsd jexec' can apply rctl/nice/setfib settings for execution:

/usr/local/bin/cbsd jexec jname=${jname}

I've fix this soon as I get to the normal keyboard ;-) Thanks you for contribution!

olevole added a commit that referenced this issue Oct 3, 2017
After PATH resseting (protection for base script conflict with CBSD) we must
call CBSD jexec, not system jexec(8). Reported by Christopher Haglund aka sweco-secfha, Issue  #197

While im here: fixes minimal base fileset for FreeBSD 12+
@olevole

This comment has been minimized.

Copy link
Collaborator

@olevole olevole commented Oct 3, 2017

Can you fetch fixes via

fetch -o /usr/local/cbsd/jcreate.subr https://raw.githubusercontent.com/cbsd/cbsd/master/jcreate.subr
  • re-run:
cbsd initenv

And check this issue again?

olevole added a commit that referenced this issue Oct 3, 2017
We dont need to restore PATH here due to cbsd shell will override it anyway.
We need to overwrite PATH only for master hook execution, not for jexec.  Issue #197
@olevole

This comment has been minimized.

Copy link
Collaborator

@olevole olevole commented Oct 3, 2017

upd: correct myself: we do not need to reset PATH for jexec, revert it back and remove PATH redefining.

Reseting of PATH should remain only when the master scripts are executed: they must be performed without CBSD PATH but with CBSD variables: https://www.bsdstore.ru/en/11.1.x/wf_cbsd_variables_ssi.html

@sweco-secfha

This comment has been minimized.

Copy link
Author

@sweco-secfha sweco-secfha commented Oct 3, 2017

Thank you, for your great work!
I can confirm that this fixed the issue. :)

@olevole

This comment has been minimized.

Copy link
Collaborator

@olevole olevole commented Oct 4, 2017

commited in ports tree, 11.1.7

@olevole olevole closed this Oct 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.