Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
SSC_Seb
New Contributor

"Configuration File Error" when trying to upload CLI script - works fine on CLI?

Hey all

 

Trying to automate a few things so I made a script that makes a script that makes the many objects I need to create on a regular basis. The problem is that whatever I do, I can't get the "Upload bulk CLI file" to take my CLI script, all I get is "configuration file error". Pasting the whole script on the CLI works fine and behaves exactly as expected, so I have no idea what the GUI upload function is going on about. Here's a super simple CLI script I made for testing:

 

config firewall address
edit "Blocked-IP-22.222.22.222"
set subnet 22.222.22.222 255.255.255.255
next
edit "Blocked-IP-222.22.222.22"
set subnet 222.22.222.22 255.255.255.255
next
edit "Blocked-IP-11.111.11.111"
set subnet 11.111.11.111 255.255.255.255
next
edit "Blocked-IP-111.11.111.11"
set subnet 111.11.111.11 255.255.255.255
next

end

 

4 simple address objects to create. Even if they exist, this doesn't produce any error on CLI since it's just editing existing objects anyway. GUI though, "configuration file error" and I can't really find anything on bulk scripts except that you just put the commands in the file and away you go. But it doesn't go. Why?

 

 

1 Solution
ede_pfau
SuperUser
SuperUser

hi,

 

I've just uploaded your script to my 60E, running v5.4.4, without any problems.

To debug bulk scripts:

1- connect via ssh or serial Console

2- enter 'diag deb en'

3- enter 'diag deb cli 7'

4- upload bulk script

 

You will see each line of the script echoed in the terminal, with "0:" prepended if successful and a negative number if not. You should see an error message then.

 

Finally,

5- diag deb cli 3

6- diag deb dis

 

Ede Kernel panic: Aiee, killing interrupt handler!

View solution in original post

Ede Kernel panic: Aiee, killing interrupt handler!
4 REPLIES 4
ede_pfau
SuperUser
SuperUser

hi,

 

I've just uploaded your script to my 60E, running v5.4.4, without any problems.

To debug bulk scripts:

1- connect via ssh or serial Console

2- enter 'diag deb en'

3- enter 'diag deb cli 7'

4- upload bulk script

 

You will see each line of the script echoed in the terminal, with "0:" prepended if successful and a negative number if not. You should see an error message then.

 

Finally,

5- diag deb cli 3

6- diag deb dis

 

Ede Kernel panic: Aiee, killing interrupt handler!
Ede Kernel panic: Aiee, killing interrupt handler!
SSC_Seb

That was useful. Unexpected output from the debug:

 

FGT1 # cmd=▒▒c -61: ▒▒c FGT1 # Backtrace: [0x08b64ea8] => /bin/httpsd [0x0834422a] => /bin/httpsd [0x08b64c1f] => /bin/httpsd [0x400a0ef8] => ../lib/libc.so.6 liboffset 0001cef8

 

Given the weird format, I checked my script file and let's just say the encoding was very strange (WTH is UCS 2 BE BOM?). Switched it to UTF-8, uploaded, works fine. Now to look at my master script and get it to set the encoding properly... Thanks for the help!

ede_pfau

Some editors include a BOM right at the start of the file to indicate the UTF encoding. FOS of course chokes on that.

Talk to your editor :)

Ede Kernel panic: Aiee, killing interrupt handler!
Ede Kernel panic: Aiee, killing interrupt handler!
SSC_Seb

I spoke to my PowerShell script in gentle tones, got it to output UTF8, found out MS in their wisdom does BOM by default in PowerShell output with Out-File, switched all my encoding to ASCII because 1 byte should be enough for every char, and now the resulting file loads in FGT fine. I know there's workarounds to the PS BOM issue with .Net classes instead of Out-File but my script works now and that's all that's really important. Thanks for the help again.

Announcements

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.

Labels
Top Kudoed Authors