cat ${OPENSHIFT_LAB_PATH} /ssh_key.pub | ssh root@192.168.8.1 " cat >> /etc/dropbear/authorized_keys"
export EDGE_ROUTER=10.11.12.1
export EDGE_NETMASK=255.255.255.0
export LAB_DOMAIN=my.awesome.lab
WORK_DIR=$( mktemp -d)
cat << EOF > ${WORK_DIR} /uci.batch
set dropbear.@dropbear[0].PasswordAuth="off"
set dropbear.@dropbear[0].RootPasswordAuth="off"
set network.lan.ipaddr="${EDGE_ROUTER} "
set network.lan.netmask=${EDGE_NETMASK}
set network.lan.hostname=router.${LAB_DOMAIN}
set dhcp.lan.leasetime="5m"
set dhcp.lan.start="225"
set dhcp.lan.limit="30"
add_list dhcp.lan.dhcp_option="6,${EDGE_ROUTER} "
commit
EOF
scp -O -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedAlgorithms=+ssh-rsa ${WORK_DIR} /uci.batch root@192.168.8.1:/tmp/uci.batch
ssh root@192.168.8.1 " cat /tmp/uci.batch | uci batch ; \
rm -rf /root/.ssh ; \
mkdir -p /root/.ssh ; \
dropbearkey -t ed25519 -f /root/.ssh/id_dropbear ; \
reboot"
rm -rf ${WORK_DIR}
Configure Router Wireless
ssh root@${EDGE_ROUTER} " opkg update ; \
opkg install wipefs ip-full procps-ng-ps bind-server bind-tools bash shadow uhttpd sfdisk rsync resize2fs wget block-mount ; \
echo 'src/gz OpenWrt https://downloads.openwrt.org/snapshots/packages/arm_cortex-a7/packages' >> /etc/opkg/customfeeds.conf ; \
opkg update ; \
opkg install haproxy"
/etc/init.d/gl_nas_diskmanager disable
/etc/init.d/gl_nas_diskmanager stop
/etc/init.d/gl_nas_sys disable
/etc/init.d/gl_nas_sys stop
/etc/init.d/gl_nas_sys_dl disable
/etc/init.d/gl_nas_sys_dl stop
/etc/init.d/gl_nas_sys_up disable
/etc/init.d/gl_nas_sys_up stop
rm -rf /etc/hotplug.d/block/30-mount
rm -rf /etc/hotplug.d/block/31-mount
wipefs -af /dev/mmcblk0
echo " /dev/mmcblk0p1 : start=1, type=83" > /tmp/part.info
sfdisk --no-reread -f /dev/mmcblk0 < /tmp/part.info
rm /tmp/part.info
mkfs.ext4 /dev/mmcblk0p1
mkdir -p /usr/local
PART_UUID=$( block info /dev/mmcblk0p1 | cut -d\" -f2)
MOUNT=$( uci add fstab mount)
uci set fstab.${MOUNT} .target=/usr/local
uci set fstab.${MOUNT} .uuid=${PART_UUID}
uci set fstab.${MOUNT} .enabled=1
uci commit fstab
block mount
sed -i " s|listen 80|listen 10.11.12.1:80|g" /etc/nginx/conf.d/gl.conf
sed -i " s|listen 443|listen 10.11.12.1:443|g" /etc/nginx/conf.d/gl.conf
sed -i " /listen \[::\]:80/d" /etc/nginx/conf.d/gl.conf
sed -i " /listen \[::\]:443/d" /etc/nginx/conf.d/gl.conf
/etc/init.d/nginx restart
opkg install make git-http
stream {
upstream okd_6443 {
server 10.11.12.200:6443 max_fails=3 fail_timeout=5s;
server 10.11.12.201:6443 max_fails=3 fail_timeout=5s;
server 10.11.12.202:6443 max_fails=3 fail_timeout=5s;
}
server {
listen 6443;
proxy_pass okd_6443;
}
}