Skip to content

Instantly share code, notes, and snippets.

@jhrcz
Last active December 23, 2015 11:00
Show Gist options
  • Save jhrcz/6625052 to your computer and use it in GitHub Desktop.
Save jhrcz/6625052 to your computer and use it in GitHub Desktop.
nginx-satisfy-any-remoteaddr-clientcert
# satisfy any like funkcionality in nginx
# with client certificat or remote address
#
# based on https://sys-notes.com/bin/view/Main/NginxSSLClientAuth
#
#if ($ssl_client_s_dn !~ "(O=My Company)") {
# return 403;
#}
set $accessok "";
if ($remote_addr ~ "123.456.789.123") {
set $etnok "${accessok}ok";
}
if ($ssl_client_s_dn ~ "(O=My Company)") {
set $etnok "${accessok}ok";
}
if ($accessok !~ "ok") {
return 403;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment