ungleich-tools/mikrotik-setup.sh

46 lines
873 B
Bash
Raw Permalink Normal View History

#!/bin/sh
# Nico Schottelius, 2019-12-02
# Setup standard mikrotik settings
if [ $# -lt 1 ]; then
echo "$0 <target> [target]"
exit 1
fi
target=$1; shift
conf() {
echo $@
ssh admin@${target} "$@"
}
copy() {
scp "$1" admin@${target}:
}
# store ssh key in the admin user!
copy ~/.ssh/id_rsa.pub
conf "/user ssh-keys import user=admin public-key-file=id_rsa.pub"
conf "/file remove id_rsa.pub"
# remove unecessary stuff
for unusedpkg in calea gps lora mpls openflow tr069-client ups \
advanced-tools hotspot ntp; do
conf "/system package uninstall $unusedpkg"
done
# ensure important stuff is enabled
for wantpkg in wireless; do
conf "/system package enable $wantpkg"
done
# TODOs:
# setup capsman
# setup IPv6
# setup password
# disable dhcp server
# New script for setting up the main capsman:
# certificate generation!