I came up with only two solutions:
- Disable entirely the
- Disable only the selected api entry (admin.addPeer). To do so, you have to modify the source code of geth to eliminate the
admin.addPeer from the admin api and recompile geth from scratch.
- Remove entirely the admin interface from the source code (?)
I think that the most viable way is to use possibility 1. Essentially, when you are using the console you have three possibilities to communicate with a running node:
IPC - Interprocess-comunication
In this case (at least version 1.8.10-stable-eae63c51) you cannot disable the admin interface (although https://github.com/ethereum/go-ethereum/wiki/Management-APIs the
--ipcapi is reported).
RPC - Remote Procedure-Call
In this case, you can specify exactly which interface your node will support.
geth --ipcdisable --rpc --rpcapi "eth,web3"
and then you can connect with another terminal with the command:
geth attach http://localhost:8545
WS - Websocket
geth --ipcdisable --ws --wsapi "eth,web3"
and then you can connect from another terminal with the following command
geth attach ws://127.0.0.1:8546