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

RHEL7 document git and proxy to make update via web interface work #146

Open
liedekef opened this issue Feb 12, 2019 · 9 comments
Open

RHEL7 document git and proxy to make update via web interface work #146

liedekef opened this issue Feb 12, 2019 · 9 comments
Assignees
Labels
help wanted This is an issue that community can help with T: enhancement Type: enhancement. This issue seeks an improvement of an existing feature

Comments

@liedekef
Copy link

Work environment

Questions Answers
Type of issue Bug
OS version (server) RedHat, ...
OS version (client) 7
PHP version scl 7.1...
MISP version / git hash 2.4 latest
Browser If applicable

Expected behavior

Update starts

Actual behavior

After fixing the git tag to point to 2.4, update from the web interface should work. However, clicking on the button gives me a grayed out screen (like an overlay popup not being shown), but nothing else happens. There's nothing in /var/log/audit/ pointing to selinux issues, and the logs in app/tmp/logs are not showing anything too. It seems something is being blocked, but I can't pinpoint it.

@liedekef
Copy link
Author

liedekef commented Feb 12, 2019

Ok, follow-up: it seems the popup is not working in google chrome, but it is working in internet explorer.
However, now new permission issues are popping up (fyi: selinux is active, the .git subdir is owned by the http-process user):

git checkout app/composer.json 2>&1

fatal: Unable to create '/var/www/MISP/.git/index.lock': Permission denied

git pull origin 2.4 2>&1

fatal: Unable to create '/var/www/MISP/.git/index.lock': Permission denied
error: cannot open .git/FETCH_HEAD: Permission denied

Edit: when disabling SELinux (just to try), I get this in the logs:

2019-02-12 14:41:40 Error: [BadRequestException] The request has been black-holed
Request URL: /servers/update

@SteveClement
Copy link
Member

Hmm, try to reset the permissions as per the Centos guide, it might be more up to date:

https://misp.github.io/MISP/xINSTALL.centos7/#5-set-the-permissions

@liedekef
Copy link
Author

Besides the black-holed issue (help on that please), the documentation for both redhat and centos is missing some stuff: one should not use chcon (unless for quick testing), but semanage+restorecon. Reason: when the next selinux relabel happens, all those selinux contexts would be reset otherwise.
But currently the problem with selinux permissions appears to be that the webserver homedir is also being used to write temporary stuff in (subdir .pki/nssdb being created), and selinux is not allowing that.

@SteveClement
Copy link
Member

I see, I would need to dig much deeper into CentOS/RHEL to make it cleaner.
Thus I cannot really help you yet.

@iwitz
Copy link

iwitz commented Feb 12, 2019

Are you using a web proxy ? The function that updates MISP doesn't take the web proxy parameter into account when updating which can cause the update through the web interface to "hang" ( because git is waiting for an HTTP response that it is not getting ). If you run ps -e | grep git after trying to update, do you have git processes ?
I'll submit a PR for this tomorrow.

@liedekef
Copy link
Author

While I am using a proxy, I configured git to also use the proxy (using "git config http.proxy" and "git config https.proxy"), I don't see a need for a PR-request for this.
To summarize:

  • the popup to confirm the update is not working in chrome, only in IE (this is a shame)
  • git works, but I get permission denied because of selinux issues with the webserver home-dir
  • the documentation for redhat, centos (in fact, any selinux-enabled distro) is lacking (semanage+restorecon should be used, not just chcon)
  • if disabling selinux (to get around things quickly), I get the black-holed message on /servers/update

So any help on the black-holed issue is currently appreciated (and the popup should work in chrome too), otherwise I can't update at all (since it is recommended to use the webinterface for updates ...).

@SteveClement
Copy link
Member

@iwitz Thanks for that, yes this typically wants to be in misp-book.

I will bag and tag this one ;)

@SteveClement SteveClement transferred this issue from MISP/MISP Feb 19, 2019
@SteveClement SteveClement changed the title RHEL7 update via web interface RHEL7 document git and proxy to make update via web interface work Feb 19, 2019
@SteveClement SteveClement self-assigned this Feb 19, 2019
@liedekef
Copy link
Author

liedekef commented Feb 21, 2019

I finished my setup in RHEL7, and I'm willing to just take the current doc (the doc for redhat/centos seems to be gone now) and change it so it works :-)

Some things:

  • the first part is already wrong: when in "detached head" git mode, the web interface will refuse updates
  • you also need to use a newer version of git from scl (so rh-git218 for example)
  • php-fpm needs these extra settings in www.conf:
env[PATH] = /opt/rh/rh-git218/root/usr/bin:/opt/rh/rh-redis32/root/usr/bin:/opt/rh/rh-python36/root/usr/bin:/opt/rh/rh-php71/root/usr/bin:/usr/local/bin:/usr/bin:/bin
  • if you ever want the update to work via the webinterface, the selinux permissions should be totally different on the whole part. These should be sufficient:
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/MISP(/.*)?"
restorecon -R /var/www/MISP/
  • when pip install is finished, you need to set the selinux permissions on those files too:
    restorecon /opt/rh/rh-python36

@enjeck enjeck added help wanted This is an issue that community can help with T: enhancement Type: enhancement. This issue seeks an improvement of an existing feature labels Nov 17, 2020
@chrisinmtown
Copy link
Contributor

I thought the direction from CIRCL is to avoid SE Linux entirely (which is what we do), did I misunderstand?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted This is an issue that community can help with T: enhancement Type: enhancement. This issue seeks an improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

5 participants