I'm not aware of a way to do what you are asking because deny
permissions are always stronger than grant
permissions, so the instruction to deny access to /sitecore/*
would beat the instruction to grant access to /sitecore/service/keepalive.aspx
.
Instead, I would recommend following Sitecore's Security Hardening Guide (section 1.5):
To restrict access to the client interfaces, we recommend that you
implement IP-based security restrictions or disable Anonymous IIS
access to the /sitecore/admin
, /sitecore/login
, /sitecore/shell
folders and to the /sitecore/default.aspx
page.
Also related (from the same section):
The /sitecore/service folder should be excluded from the IIS
restrictions because it contains a number of service ASPX pages that
are used by Sitecore to report various conditions that can occur in
the application, such as, 404 Page Not Found or 403 Forbidden to the
web client.
However, you can move the files from the /sitecore/service folder to
the /sitecore folder. If you move the files, you must also update the
following settings in the web.config file:
- ErrorPage
- NoAccessUrl
- NoLicenseUrl
- LayoutNotFoundUrl
- ItemNotFoundUrl
- LinkItemNotFoundUrl
negates
the service folder acess (i.e. still allows request access to items in that folder)