TCL/Perl scipting for PF


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting TCL/Perl scipting for PF
# 1  
Old 09-24-2008
TCL/Perl scipting for PF

Hi All,


I have a PF Firewall running on Freebsd v6.x Now I would like to change and review the config in my rc.conf file via a browser . So my approach here would be:

- make a script , which changes for instance the default route

- have this script built-in a Webpage and have a form field where i can give in the IP address as default gateway and have the script started via a submit button

Now my question is:

- does anyone has a script for me which would accomplish that task?
- which scripting language shall I sue, TCL or Perl for also having this one embedded into my Webpage?

thx for your feedback
# 2  
Old 09-24-2008
I would use perl / cgi to accomplish. If I got it correctly, you want to update rc.conf file via webpage, where you have fields to update certain values. But I think some changes in rc.conf would require reboot of the machine, or I'm wrong ?
# 3  
Old 09-25-2008
well, i wouldn't be rebooting the system after changing some values, for others indeed. do you happen to have an example for that scripting?
# 4  
Old 09-25-2008
You can use any language you want for CGI, Perl is certainly more mainstream for this sort of thing but whatever works for you.
# 5  
Old 09-25-2008
tx, I will try it and keep you folks posted,

if in the meantime anyone has a script which could be used as an example, i'd appreciate that

bye
# 6  
Old 09-25-2008
Well, it depends on the architecture of the script, can you post sample input / file and desired output. Also, some security considerations - do you really want web page that someone can access and change your default route ?
# 7  
Old 09-25-2008
When I am booting system my rc.conf look as following

ifconfig_rl0="192.168.2.1"
ifconfig_rl1="192.168.1.1"

gateway_enable="YES"
#natd_enable="YES"
#natd_interface="rl1"
#natd_flags="-f /etc/natd.conf"
#firewall_enable="YES"
#firewall_type="OPEN"
defaultrouter="192.168.1.254"
pf_enable="YES"
pf_rules="/etc/pf.conf"
pf_flags=""
pflog_enable="YES"
pflog_logfile="/var/log/pf.log"
pflog_flags=""

dhcpd_enable="YES"
dhcpd_flags="-q"
dhcpd_conf="/usr/local/etc/dhcpd.conf"
dhcpd_ifaces="rl0"

now my output on the webpage should look like this:

IP addresses rl0: 192.168.2.1 /24 <edit-button>
IP addresses rl0: 192.168.1.1 /24 <edit-button>

Route: 0.0.0.0 /0 192.168.1.254 <edit-button>

<add-button>

<apply-button> ----> saves it permanently in the rc.conf file


And for the HTTP session, I'd only like to enable the port for HTTP on the inside (with local auth database)

So this is the whole task, and I am struggling even with part one to choose the right scripting lang:-)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Expect/tcl (not perl) logging troubles

My logs aren't correct. Im trying to log failure and successes, then use the resulting successes file "seed" to perform another function. Problem is that the log has only a single random entry. Thanks in advance for the help ! !#/usr/bin/expect set count 0 set bcount 0 set fcnb 923... (0 Replies)
Discussion started by: sumguy
0 Replies

2. Shell Programming and Scripting

Bash Scipting (New); Run multiple greps > multiple files

Hi everyone, I'm new to the forums, as you can probably tell... I'm also pretty new to scripting and writing any type of code. I needed to know exactly how I can grep for multiple strings, in files located in one directory, but I need each string to output to a separate file. So I'd... (19 Replies)
Discussion started by: LDHB2012
19 Replies

3. Shell Programming and Scripting

Adding time to date time in UNIX shell scipting

I needed some help in adding a duration (in seconds) to a start time (in hhmmss format) and a start date (in mmddyy format) in order to get an end date and end time. The concept of a leap year is also to be considered while incrementing the day. The code/ function that I have formed so far is as... (3 Replies)
Discussion started by: codehelp04
3 Replies

4. Shell Programming and Scripting

TCL script in PERL

Hi all, I am trying to run a tcl script in a perl script. Now my problem is when I run the tcl script from the perl script it runs very slowly but when I run the tcl script individually it is running at expected speed. What could be the problem?? Help please!!!! Thanks (0 Replies)
Discussion started by: mirock
0 Replies

5. Shell Programming and Scripting

executing perl with arguments in tcl

I have a question on perl/Tcl script execution .... right now i have both perl and Tcl script working individually standalone but i want to integrate the perl script in a Tcl script .... and the perl has the arguments to be passed along with command line execution and this argument is actually... (0 Replies)
Discussion started by: sukrish
0 Replies

6. Shell Programming and Scripting

Perl or Tcl/tk : Which one is better ?

Hi, I am just going to start learning perl, but i have about tcl that it is easy. So , i am confused that whether to go for tcl or perl. I am just learning it as my interest, but still in future which one of these will benefit me. Also please guide me about tk, can we make GUI based applications... (4 Replies)
Discussion started by: sarbjit
4 Replies

7. Shell Programming and Scripting

Running Perl script in TCL script

Hi, experts, I wonder if anyone can help me up with this. Has been googling and reading several books but still come to no idea how this can be done. Well, it's like this. I have a bundle of codes developed in Perl. I need to do something like this: 1. perl script run using spawn 2. in... (3 Replies)
Discussion started by: dniz
3 Replies

8. Shell Programming and Scripting

TCL, how to

Does any one know how to capture the output of command called from a TCL script? I cannot figure this out. I've been working on it for 4 hours now :confused: (2 Replies)
Discussion started by: Lorna
2 Replies

9. Shell Programming and Scripting

Shell Scipting

Hi There, I am new in UNIX I want to learn shell scripting please advice where should I start from, If anybody tell me how can I install a unix software from my windows XP I will be very greatful. I apprechiate in advance! Zeeshan (4 Replies)
Discussion started by: zsiddiqui
4 Replies

10. Shell Programming and Scripting

Basic Scipting problem need help for school

How to make this script? 1. Write a portable bash shell script called change_password.bash that will prompt the user for a password. Use a series of if statements to test if: 1. The password is NOT 6 or more characters 2. The password does not contain at least 3 consecutive letters... (1 Reply)
Discussion started by: 3junior
1 Replies
Login or Register to Ask a Question