See also: Elevating privileges with sudo
There are some possibilities to grant access to the router (or to any PC/Server):
signature instead of a password (e.g. SSH with dropbear.public-key.auth)If you ask for username/password, an attacker has to guess the combination. If you use an unencrypted connection, they could eavesdrop on you and obtain your credentials.
If you use an encrypted connection, any eavesdropper would have to decrypt the packets first. This is always possible. How long it takes to decrypt the content, depends on the algorithm and key length you used.
Also, as long as an attacker has network access to the console, they can always run a brute-force attack to find out your username and password. They does not have to do that themself: they can let their computer(s) do the guessing. To render this option improbable or even impossible you can:
rootrootIf you have an external disk you may want to encrypt it.
logtrigger.For secure web access, OpenWrt can be accessed via HTTPS (TLS) instead of the unencrypted HTTP protocol. If HTTP is not secure enough for you, you can disable the existing (unencrypted) web access and either
uci -q delete uhttpd.main.listen_http uci commit uhttpd /etc/init.d/uhttpd restart
OR Rebind to LAN only and redirect all http requests to https:
uci set uhttpd.main.listen_http="192.168.1.1:80" uci set uhttpd.main.listen_https="192.168.1.1:443" uci set uhttpd.main.redirect_https="1" uci commit /etc/init.d/uhttpd restart
Can mandatory client certificate checking be set up with uhttpd? → not possible with uhttpd
If you require remote SSH access, follow the hardening instructions on SSH mentioned above.
When using PPP, protect its credentials from unprivileged users.
PPP_IF="wan" PPP_USER="$(uci -q get network.${PPP_IF}.username)" PPP_PASS="$(uci -q get network.${PPP_IF}.password)" cat << EOF >> /etc/ppp/options user ${PPP_USER} EOF cat << EOF >> /etc/ppp/chap-secrets ${PPP_USER} * ${PPP_PASS} EOF ln -f /etc/ppp/chap-secrets /etc/ppp/pap-secrets chmod go= /etc/ppp/chap-secrets uci -q delete network.${PPP_IF}.username uci -q delete network.${PPP_IF}.password uci commit network /etc/init.d/network restart