Files
pxe_boot_alma/work/KickStart/cfg/probe-config.cgi
T
andersenandClaude Fable 5 6d398b826a refactor: move tree under homelab/, add alma10 hardening and kickstart docs
- restructure boot/kickstarts/scripts/docs into homelab/
- docs: alma9->10 breaking changes, CIS hardening, kickstart changes
- add find_cron_entries.sh helper and codex running memory notes

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-06 22:35:07 -04:00

137 lines
3.4 KiB
Perl
Executable File

#!/usr/bin/perl
my $KSDIR = "/home/KickStart/cfg";
my $STAGD = "$KSDIR/stag.d";
$DEBUG = 1;
my @TZONES = ( "US/Arizona", "US/Eastern", "US/Hawaii", "US/Pacific", "US/Central", "US/East-Indiana", "US/Indiana-Starke", "US/Mountain" );
my @ETHS = ( "ETH0", "ETH1", "ETH2", "ETH3" );
my $defaultPROBE = "iprobe";
my $defaultTZ = "US/Eastern";
my $defaultGW = "192.168.";
my $defaultMASK = "255.255.255.240";
print "Content-type: text/html\n\n";
print "<html>\n";
print "<head>\n";
print " <title> iGlass Probe Config </title>\n";
print "</head>\n";
print "<body>\n";
print "<h3>iGlass Probe Config</h3>\n";
# Make changes if any
my @stdin = <STDIN>;
if ( @stdin ) {
my $rlst;
my $clst;
print "<pre>\n" if $DEBUG;
foreach my $line ( @stdin ) {
foreach my $pair ( split(/\&/,$line) ) {
$pair = URLDecode($pair);
if ( $pair =~ /^(\S+)=(.+)$/ ) {
print "config $1=$2\n" if $DEBUG;
}
}
}
print "</pre>\n" if $DEBUG;
}
# Start the form
print "<form method=POST action=\"/KickStart/cfg/probe-config.cgi\">\n";
print "<table width=\"100%\"><tr><td valign=\"top\">\n";
print "<p>\n";
{ # Service Tag
print "Service Tag: <input type=\"text\" size=\"12\" name=\"STAG\" >\n";
}
print "<p>\n";
{ # Customer
print "Customer: <input type=\"text\" size=\"12\" name=\"CUST\" >\n";
}
print "<p>\n";
{ # Probe
print "Probe: <input type=\"text\" size=\"12\" name=\"PROBE\" value=\"$defaultPROBE\" >\n";
}
print "<p>\n";
print "Time Zone: <select name=\"TZ\">";
foreach my $type ( @TZONES ) {
my $checked;
if ( "$type" eq "$defaultTZ" ) {
$checked = "selected=\"selected\"";
}
print "<option value=\"$type\" $checked> $type \n";
}
print "</select>\n";
print "<p>\n";
{ # Default Gateway
print "Default Gateway: <input type=\"text\" size=\"15\" name=\"GATEWAY\" value=\"$defaultGW\" >\n";
}
print "<p><table width=\"100%\"><tr>\n";
# Ethernet
foreach $eth ( @ETHS ){
print "<td><b>$eth:</b><br>";
print "IP Address: <input type=\"text\" size=\"15\" name=\"$eth.IP\" value=\"\" ><br>\n";
print "Netmask:&nbsp;&nbsp;&nbsp; <input type=\"text\" size=\"15\" name=\"$eth.MASK\" value=\"$defaultMASK\" ><br>\n";
print "</td>";
}
print "</tr></table>\n";
print "</td><td valign=\"top\" align=\"right\">\n";
print "<input type=\"submit\" value=\"Add\">";
print "<input type=\"reset\" value=\"Cancel\"><br>";
print "<p align=\"right\"><a href=\"/KickStart/cfg/config.cgi\"><small>Edit ks config</small></a></p>\n";
print "</td></tr></table>\n";
print "<p><hr>\n";
if ( opendir(SD, "$STAGD") ) {
my @fileList = grep(!/^\./, readdir(SD));
close SD;
print "<pre>\n" if $DEBUG;
foreach my $file ( @fileList ) {
if ( $file =~ /^(\w+)\.cfg$/ ) {
print "<a href=\"/KickStart/cfg/stag.d/$file\">$1</a>" if $DEBUG;
} elsif ( $file =! /^HEADER/ ) {
} else {
print "<h3>Warning: What is this file $STAGD/$file</h3>\n";
}
}
print "</pre>\n" if $DEBUG;
} else {
print "<h3>Erorr: Could not open directory $STAGD</h3>\n";
}
print "</form>\n";
print "</body>\n";
sub URLDecode {
my $url = shift;
$url =~ tr/+/ /;
$url =~ s/%([a-fA-F0-9]{2,2})/chr(hex($1))/eg;
$url =~ s/<!--(.|\n)*-->//g;
return $url;
}
sub URLEncode {
my $url = shift;
my $MetaChars = quotemeta( ';,/?\|=+)(*&^%$#@!~`:');
$url =~ s/([$MetaChars\"\'\x80-\xFF])/"%" . uc(sprintf("%2.2x",ord($1)))/eg;
$url =~ s/ /\+/g;
return $theURL;
}