ungleich-tools/mikrotik/mikrotik-setup.sh
2020-12-12 13:27:49 +01:00

50 lines
984 B
Bash
Executable file

#!/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() {
if echo ${target} | grep -q :; then
ltarget="[$target]"
else
ltarget="$target"
fi
scp "$1" admin@${ltarget}:
}
# 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!