Hello SONiC folks,
I am evaluating SONiC as a platform for future projects, and part of that is of course security.
I was quite surprised to find out that the default REST API configuration appears to be "client_auth = none" from reading the DB schema[1] and observing how SONiC 202012 works.
If SONiC aims to be secure by default, I would probably call this a bug. If it does not aim to be secure by default, why not?
From what I can tell, the REST API seems to be all-powerful so this seems pretty bad to allow unauthenticated remote endpoints to talk to it.
Let's assume for a second this is working as intended, and that unauthenticated API requests are the expected bring-up state. What is the expected user journey towards locking down the switch for production use? To me it seems impossible to do currently - let me explain:
- So far I had to manually hack in a "REST_SERVER" object in /etc/sonic/config_db.json in order to set "client_auth". There appears to be no CLI command to easily do this currently - that's unfortunate but not unacceptable.
- Doing a "config load" with that configuration file (and docker restart on sonic-mgmt-framework) sadly wasn't enough to enable "client_auth" so I rebooted the switch as a last resort.
- This seemed to trigger a recalculation of the flags to "rest_server", but it seems that providing any REST_SERVER object is broken due to a typo in the template[2] (RESET_SERVER vs REST_SERVER). This causes the sonic-mgmt-framework subsystem to crash-loop.
Are people simply running their SONiC switches without API authentication, or am I missing something huge?
Regards,