iPXE discussion forum
Pass CGI arguments to kickstart - Bring back uristring encoding? - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: Pass CGI arguments to kickstart - Bring back uristring encoding? (/showthread.php?tid=7727)



Pass CGI arguments to kickstart - Bring back uristring encoding? - nichivo - 2015-05-19 03:31

I'm migrating from PXELINUX and currently pass CGI parameters to a CentOS kickstart file dynamically generated by PHP. iPXE 1.0.0 works fine but the latest git release no longer supports uristring as removed by:

https://git.ipxe.org/ipxe.git/commit/09b057ce841156cf8dfb8d356d36b046d875cdf4

I think git iPXE automatically URI encodes the first argument to the kernel command which is usually vmlinuz. But I want to pass the parameters onto the kickstart.

Here is a simplified extract of what I'm trying to do:

# read custom settings
echo -n Use RAID [0|1]: ${} && read raid
echo -n Use LVM [0|1]: ${} && read lvm

# create query string
set query raid=${raid:uristring}
set query ${query}&lvm=${lvm:uristring}

kernel centos7/vmlinuz root=live:centos7/squashfs.img ks=${base-url}/ks/ks7.php?${query}

Am I stuck with 1.0.0 or is there a better way to pass args to the kickstart?


RE: Pass CGI arguments to kickstart - Bring back uristring encoding? - NiKiZe - 2015-06-02 23:56

(2015-05-19 03:31)nichivo Wrote:  # read custom settings
echo -n Use RAID [0|1]: ${} && read raid
echo -n Use LVM [0|1]: ${} && read lvm

For reference how does the data entered on those look?
maybe you can also provide how the full "invalid" url looks, and what you do expect instead?

There is some discussion on the Mailing list already, and this probably falls under that as well.


RE: Pass CGI arguments to kickstart - Bring back uristring encoding? - nichivo - 2015-06-05 03:13

Input for the lvm and raid values are just zero or one. I just used them as brief examples but they don't include any characters that need encoding! Sorry, a better example is:

Code:
echo -n Media: ${}              && read media

for which I would enter something like:

Code:
media url --url http://mirror.centos.org/centos/7/os/x86_64/

This contains at least spaces which should be encoded as %20. From what I can tell, git iPXE only automatically encodes the first argument as in the examples from the mailing list you referenced.

Automatic URI encoding (of the first argument) is nice when your using things like:

Code:
chain ${url_with_spaces}

but the kickstart URL at the end is not automatically URI encoded and I can no longer manually URI encode it since "uristring" is now an alias for "string":

Code:
# ipxe command (abbreviated with ...)
kernel vmlinuz ... ks=http://ks.lan/ks/ks7.php?${query}

# expands to
kernel vmlinuz ... ks=http://ks.lan/ks/ks7.php?raid=1&lvm=1&media=media url --url http://mirror.centos.org/centos/7/os/x86_64/

# actually calls (truncates after first space)
kernel vmlinuz ... ks=http://ks.lan/ks/ks7.php?raid=1&lvm=1&media=media

# should expand to
kernel vmlinuz ... ks=http://ks.lan/ks/ks7.php?raid=1&lvm=1&media=media%20url%20%2d%2durl%20http%3a%2f%2fmirror%2ecentos%2eorg%2fcentos%​2f7%2fos%2fx86_64%2f

I'm currently using v1.0 which supports manual uristring but it would be nice to use newer versions Wink