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

Error upgrading CBSD v.10.3.0 #65

Closed
Juronski opened this issue Mar 9, 2016 · 9 comments
Closed

Error upgrading CBSD v.10.3.0 #65

Juronski opened this issue Mar 9, 2016 · 9 comments
Assignees

Comments

@Juronski
Copy link

Juronski commented Mar 9, 2016

Hi,

Have an issue after upgrading to CBSD v.10.3.0.

When i do sudo cbsd initenv I get no workdir. This does not change when I do env workdir="/usr/jails" /usr/local/cbsd/sudoexec/initenv.

When I do cbsd help I get /usr/local/bin/cbsd: cpr: not found and Illegal option See the attached file.

What can I do about this?

Thank you in advance.

J.

cbsderror

@olevole olevole self-assigned this Mar 9, 2016
@olevole
Copy link
Member

olevole commented Mar 9, 2016

Hi,

Error associated with cpr is not fatal - I'll fix it, thanks (this is old script which i forget to remove)

For initenv/workdir: Do I understand correctly that before CBSD did not work on this server?
Likely if you run it via sudo - sudo is not configured to pass environment with "workdir" name.

Can you execute:

env workdir="/usr/jails" /usr/local/cbsd/sudoexec/initenv

from root user, without sudo ?

@Juronski
Copy link
Author

Juronski commented Mar 9, 2016

Before CBSD worked correctly on this server. This issue is after upgrading from v 10.2.0. to .v 10.3.0.

I have executed (from root user, without sudo)

env workdir="/usr/jails" /usr/local/cbsd/sudoexec/initenv

than

cbsd initenv

still I get

no workdir

and also the Illegal option as above after cbsd help

@olevole
Copy link
Member

olevole commented Mar 9, 2016

According to https://github.com/olevole/cbsd/blob/master/sudoexec/initenv#L713:

if [ -z "${workdir}" ]; then
        . /etc/rc.conf
        if [ -n "${cbsd_workdir}" ]; then
            workdir="${cbsd_workdir}"
        else
            workdir="/usr/jails"
        fi
    fi

your rc.conf does not have cbsd_workdir variable. Please make sure that you have workdir in rc.conf:

grep ^cbsd_workdir /etc/rc.conf

has to return cbsd_workdir="/usr/jails". If variable exist, send binary cbsd version, shell xtrace output and truss result:

1) 
% cbsd -c version
2)
% cbsd initenv --debug
3)
% truss cbsd

and FreeBSD version:

% uname -rm

@Juronski
Copy link
Author

/usr/jails is there

grep ^cbsd_workdir /etc/rc.conf
cbsd_workdir="/usr/jails"
uname -rm
10.1-RELEASE-p6 amd64
cbsd -c version
10.3.0
cbsd initenv --debug
no workdir

Attached you find the output of truss cbsd
truss_cbsd.txt

@olevole
Copy link
Member

olevole commented Mar 10, 2016

Interesting.. a feeling that the sudo configuration does not pass workdir environment for cbsd user.
Can you check /usr/local/etc/sudoers.d/cbsd_sudoers content ? It should look like this:

% cat /usr/local/etc/sudoers.d/cbsd_sudoers

Defaults     env_keep += "workdir DIALOG NOCOLOR CBSD_RNODE"
Cmnd_Alias   CBSD_CMD = /usr/jails/sudoexec/*,/usr/local/cbsd/sudoexec/*
cbsd   ALL=(ALL) NOPASSWD: CBSD_CMD

@Juronski
Copy link
Author

The sudo configuration was not set. After setting the sudo configuration I do not get the no workdir-error anymore.

Still have the Illegal option -- and /usr/local/bin/cbsd: cpr: not found when I do CBSD help. This is associated with cpr you mentioned?

@olevole
Copy link
Member

olevole commented Mar 10, 2016

cpr: not found error you can solve by removing the line "cpr" from the file /usr/local/cbsd/securecmd and by re-runing cbsd initenv. This is already done via olevole@e0c0294 .
About "Illegal option --": this is known issue for me, but the reasons for this (and how it fix) is still unknown. I'm still in search of solutions.

@Juronski
Copy link
Author

Ok. Thank you!

@olevole
Copy link
Member

olevole commented Mar 11, 2016

Fix illegal options: olevole@0cbfad7

Thanks.

@olevole olevole closed this as completed Mar 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants