summaryrefslogtreecommitdiffstats
path: root/server/ipxe
diff options
context:
space:
mode:
authorJannik Schönartz2018-08-17 08:39:55 +0200
committerJannik Schönartz2018-08-17 08:39:55 +0200
commit1667e801098e334e30b5c8a19919084f6063b42e (patch)
tree532630c936cb5c7395b658faf24319a4bd7e0201 /server/ipxe
parent[server/router] Fix eslint errors (diff)
downloadbas-1667e801098e334e30b5c8a19919084f6063b42e.tar.gz
bas-1667e801098e334e30b5c8a19919084f6063b42e.tar.xz
bas-1667e801098e334e30b5c8a19919084f6063b42e.zip
[firstregistration] First start of the new client registration
Router now also can use non auth methods. (Used for the registration calls) Added ipxe scripts for the registration Added backend methods for dynamic ipxe scripts and first try of a dhcp api call
Diffstat (limited to 'server/ipxe')
-rw-r--r--server/ipxe/exitTestScript.ipxe57
-rw-r--r--server/ipxe/general.h2
-rw-r--r--server/ipxe/main.ipxe8
-rw-r--r--server/ipxe/registration.ipxe52
4 files changed, 114 insertions, 5 deletions
diff --git a/server/ipxe/exitTestScript.ipxe b/server/ipxe/exitTestScript.ipxe
new file mode 100644
index 0000000..7bf1df6
--- /dev/null
+++ b/server/ipxe/exitTestScript.ipxe
@@ -0,0 +1,57 @@
+#!ipxe
+dhcp
+
+:start
+menu Please choose a webserver to load the ipxe menu:
+item reg Registration
+item pxelnx PxeLinux
+item c32boot C32Boot
+item exit Exit
+item exit0 Exit0
+item exit1 Exit1
+item sh [Shell]
+choose target && goto ${target}
+
+:reg
+set crosscert http://ca.ipxe.org/auto/
+chain --replace https://bas.stfu-kthx.net:8888/api/ipxe/load/registration ||
+goto start
+
+:exit
+exit ||
+goto start
+
+:exit0
+exit 0 ||
+goto start
+
+:exit1
+exit 1 ||
+goto start
+
+:pxelnx
+# set 210:string https://bas.stfu-kthx.net:8888/
+# chain \${210:string}pxelinux.0 || goto start
+# chain https://bas.stfu-kthx.net:8888/pxelinux.0
+# set next-server bas-stfu-kthx.net:8888
+# set 209:string https://bas.stfu-kthx.net:8888/pxelinux.cfg
+# imgload pxelinux.0
+set net0/next-server 192.52.3.91 ||
+set netX/next-server 192.52.3.91 ||
+set next-server 192.52.3.91 ||
+# set 209:string pxelinux.cfg/default
+# set 210:string bas.stfu-kthx.net
+# shell ||
+boot tftp://bas.stfu-kthx.net/pxelinux.0 ||
+goto start
+
+:c32boot
+set net0/next-server 192.52.3.91 ||
+set netX/next-server 192.52.3.91 ||
+set next-server 192.52.3.91 ||
+boot tftp://bas.stfu-kthx.net/chain.c32 ||
+goto start
+
+:sh
+shell ||
+goto start \ No newline at end of file
diff --git a/server/ipxe/general.h b/server/ipxe/general.h
index 8c8687e..5ee8d0e 100644
--- a/server/ipxe/general.h
+++ b/server/ipxe/general.h
@@ -146,7 +146,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define POWEROFF_CMD /* Power off command */
//#define IMAGE_TRUST_CMD /* Image trust management commands */
//#define PCI_CMD /* PCI commands */
-//#define PARAM_CMD /* Form parameter commands */
+#define PARAM_CMD /* Form parameter commands */
//#define NEIGHBOUR_CMD /* Neighbour management commands */
//#define PING_CMD /* Ping command */
#define CONSOLE_CMD /* Console command */
diff --git a/server/ipxe/main.ipxe b/server/ipxe/main.ipxe
index 763725a..f77e58d 100644
--- a/server/ipxe/main.ipxe
+++ b/server/ipxe/main.ipxe
@@ -15,14 +15,14 @@ choose target && goto ${target}
:js
set crosscert http://ca.ipxe.org/auto/
-chain https://bas.stfu-kthx.net:8888/api/ipxe/loadScript ||
+chain --replace https://bas.stfu-kthx.net:8888/api/ipxe/load/script ||
goto start
:uw
-chain http://10.4.9.115/boot.php
+chain http://10.4.9.115/boot.php ||
goto start
:ch
-chain http://10.4.9.122/boot.php
+chain http://10.4.9.122/boot.php ||
goto start
:sh
-shell
+shell ||
goto start
diff --git a/server/ipxe/registration.ipxe b/server/ipxe/registration.ipxe
new file mode 100644
index 0000000..88dc58f
--- /dev/null
+++ b/server/ipxe/registration.ipxe
@@ -0,0 +1,52 @@
+#!ipxe
+dhcp
+
+# Wallpaper
+set crosscert http://ca.ipxe.org/auto/
+#set img https://ife-server.com/b4db0y/ipxeWallpaper4.png || shell
+#set img tftp://bas.stfu-kthx.net/ipxeWallpaper4.png || shell
+set img tftp://bas.stfu-kthx.net/ipxeWallpaper3_scale.png || shell
+console --picture ${img} --x 800 --y 600 || shell
+
+:start
+menu Initializing client registration
+item --key i init Initialize
+item --key l localboot Localboot
+item --key r reboot Reboot
+item --key p poweroff Power Off
+item --key s sh [Shell]
+choose --default init --timeout 15000 target && goto ${target} || goto init
+
+:localboot
+exit0 ||
+exit1 ||
+goto start
+
+:init
+echo Enter PC name
+read pcname
+params
+param mac ${net0/mac}
+param uuid ${uuid}
+param ip ${net0/ip}
+param name ${pcname}
+chain https://bas.stfu-kthx.net:8888/api/registration/client##params ||
+shell
+goto start
+
+:reboot
+reboot
+
+:poweroff
+poweroff
+
+:sh
+#login
+echo Enter the password to access the shell
+read pw
+iseq ${pw} shell || goto start
+clear pw
+#iseq ${password} sh || goto start
+#clear username
+#clear password
+shell \ No newline at end of file