blob: 6c4690428a3f63438b440413e2bce7fb5bb8205f [file] [log] [blame]
Thomas Vachuska12bf4452015-06-26 09:15:38 -07001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Enables secure access to ONOS console by removing default users & keys.
4# -----------------------------------------------------------------------------
5
6rm -f $(dirname $0)/onos
7
8set -e
9
10cd $(dirname $0)/../apache-karaf-*/etc
11USERS=users.properties
12KEYS=keys.properties
13
14# Remove the built-in users and keys to secure the access implicitly.
15egrep -v "^(karaf|onos)[ ]*=" $USERS > $USERS.new && mv $USERS.new $USERS
16egrep -v "^(#karaf|onos)[ ]*=" $KEYS > $KEYS.new && mv $KEYS.new $KEYS
17
18# Remove any previous known keys for the local host.
19ssh-keygen -f "$HOME/.ssh/known_hosts" -R [localhost]:8101
20
21# Swap the onos client to use the SSH variant
22ln -s $(dirname $0)/onos-ssh $(dirname $0)/onos