You said "both are superusers". In Unix, there is only one kind of superuser, and that is root. Are you saying that the user-ID of "D" is 0?
In that case, you can not protect against D doing pretty much anything, as they can do everything that A can do. For example, you can use chmod and chown to make files completely unreadable, but root is not bound to normal access controls:
Code:
# This example is running as root.
# cat > /tmp/foo
sdjgfsdjfgsdjgfdsjfg
# chmod 000 /tmp/foo
# ll /tmp/foo
---------- 1 ralph wheel 21 Nov 11 12:49 /tmp/foo
# cat /tmp/foo
sdjgfsdjfgsdjgfdsjfg
There are some things you can do. You can for example declare files to be completely unchangeable and undeletable, by using the schg flag (which is supported by both major file systems on FreeBSD), and then set the kernel securelevel up so nobody, not even root, can override schg flags (do man chflags and man securelevel). But: Nothing prevents D from rebooting the machine at a reduced securelevel: if anyone can do it, D can do it, and D is root.
I think the solution has to be elsewhere: D can not be root. That immediately opens a question: What do they need to do on the machine? Normal non-root accounts are VERY restricted in what they are capable of doing. You could in theory spend hours tuning permissions, so D can do their tasks as a non-root user, but I don't think this is very realistic.
What this points out is a fundamental design flaw of Unix, which has been known for about 50 years now: Unix's permission model is very coarse, it only has three levels (root, user, everyone), and it has no mechanism for partial group-czar or root permissions. This is because Unix was at its core designed to be an OS for a group of friendly computer science researchers, and the concept of "root" was intended to guard against fat-fingering, not against malice. Other OSes created at about the same time (such as VMS, and MVS with RACF) had much more complicated permission systems. For example on VMS, you can mark users as being "group czar", meaning they can do anything that root can do but only within entities (files, devices, quota) that's owned by their group. And you could mark users as "operators", which could do things like mount devices, perform other maintenance operations, and perform backups (which means they can sort of read all files), but they can not actually access resources (such as other user's files) except through opaque channels such as the backup system.