Issue #5955
closedusing cert auth throws an error: {"detail":"CSRF Failed: CSRF token missing or incorrect."}
Description
This was working but after updating my pulp installation it stopped working (i suspect its related to some sort of dependency, but i'm not sure).
# curl https://`hostname`/pulp/api/v3/repositories/file/file/ --cert /etc/pki/katello/certs/pulp-client.crt --key /etc/pki/katello/private/pulp-client.key -d '{"name":"foo"}'
{"detail":"CSRF Failed: CSRF token missing or incorrect."}
Using user/name pass works fine.
I have the following snippet in my webserver:
<Location /pulp/api/v3/>
RequestHeader set REMOTE_USER "%{SSL_CLIENT_S_DN_CN}s" env=SSL_CLIENT_S_DN
</Location>
and the following in my settings.py:
REMOTE_USER_ENVIRON_NAME = "HTTP_REMOTE_USER"
Files
Updated by daviddavis almost 5 years ago
- Triaged changed from No to Yes
- Sprint set to Sprint 64
Per triage
Updated by jsherril@redhat.com almost 5 years ago
reproduced on pulp_lift with just:
pulp3-sandbox-centos7
and the attached apache config
Updated by jsherril@redhat.com almost 5 years ago
After pulplifting:
1. yum install -y httpd mod_ssl
2. change 'Listen 80' to 81 in /etc/httpd/conf/httpd.conf
3. Drop ssl.conf from this issue into /etc/httpd/conf.d/ (replacing the existing ssl.conf
4. add "127.0.0.1 devel.balmora.example.com" to /etc/hosts
5. run 'hostname devel.balmora.example.com" to set a hostname which matches the certs
6. extract the included tarball to /etc/pki/katello/ (so /etc/pki/katello/certs/pulp-client.crt should exist)
7. chown apache /etc/pki/katello -R
8. add to /etc/pulp/settings.py REMOTE_USER_ENVIRON_NAME = "HTTP_REMOTE_USER"
9. systemctl restart pulpcore-api
10. systemctl start httpd
11. run:
curl https://`hostname`/pulp/api/v3/repositories/file/file/ --cert /etc/pki/katello/certs/pulp-client.crt --key /etc/pki/katello/private/pulp-client.key -d '{"name":"foo"}' -k
if i didn't forget any steps you should get:
{"detail":"CSRF Failed: CSRF token missing or incorrect."}
Updated by jsherril@redhat.com almost 5 years ago
Updated by bmbouter almost 5 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to bmbouter
I was able to reproduce the issue, so I'll take as ASSIGNED.
Added by bmbouter almost 5 years ago
Updated by bmbouter almost 5 years ago
- Status changed from ASSIGNED to POST
PR available at: https://github.com/pulp/pulpcore/pull/492
Updated by bmbouter almost 5 years ago
- Status changed from POST to MODIFIED
Applied in changeset pulpcore|1ae65bde73d649ac778357608a5ea84d48fd2096.
Added by bmbouter almost 5 years ago
Revision 9935b943 | View on GitHub
REMOTE_USER auth shouldn't trigger csrf rejects
Move all authentication fully to DRF. We were incorrectly configuring
webserver auth support in django and not DRF. This ports the setting
REMOTE_USER_ENVIRON_NAME
to work with DRF instead of Django.
It adjusts the settings.py so there are removal claims even though this will likely go into a z-release. It's an important FYI for the user.
https://pulp.plan.io/issues/5955 closes #5955
(cherry picked from commit 1ae65bde73d649ac778357608a5ea84d48fd2096)
Updated by bmbouter almost 5 years ago
Applied in changeset pulpcore|9935b943a5f7101d80fb12e5c72f7756181abf3d.
Added by bmbouter almost 5 years ago
Revision f5550cef | View on GitHub
REMOTE_USER auth shouldn't trigger csrf rejects
Move all authentication fully to DRF. We were incorrectly configuring
webserver auth support in django and not DRF. This ports the setting
REMOTE_USER_ENVIRON_NAME
to work with DRF instead of Django.
It adjusts the settings.py so there are removal claims even though this will likely go into a z-release. It's an important FYI for the user.
https://pulp.plan.io/issues/5955 closes #5955
(cherry picked from commit 1ae65bde73d649ac778357608a5ea84d48fd2096)
Updated by bmbouter almost 5 years ago
Applied in changeset pulpcore|f5550cefb98e5d2b6ba5559b324489e3640dc504.
Updated by bmbouter almost 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Updated by ggainey over 4 years ago
- Tags Katello added
- Tags deleted (
Katello-P1)
REMOTE_USER auth shouldn't trigger csrf rejects
Move all authentication fully to DRF. We were incorrectly configuring webserver auth support in django and not DRF. This ports the setting
REMOTE_USER_ENVIRON_NAME
to work with DRF instead of Django.It adjusts the settings.py so there are removal claims even though this will likely go into a z-release. It's an important FYI for the user.
https://pulp.plan.io/issues/5955 closes #5955