Forward Firewall:
[people/teissler/ipfire-2.x.git] / config / forwardfw / convert-outgoingfw
1 #!/usr/bin/perl
2
3
4 require '/var/ipfire/general-functions.pl';
5
6 use Socket;
7 use File::Path;
8 use File::Copy;
9
10 my $ipgrouppath = "${General::swroot}/outgoing/groups/ipgroups/";
11 my $macgrouppath = "${General::swroot}/outgoing/groups/macgroups/";
12 my $outgoingrules = "${General::swroot}/outgoing/rules";
13 my $outfwsettings = "${General::swroot}/outgoing/settings";
14 my $host = "Converted ";
15 my $confighosts = "${General::swroot}/fwhosts/customhosts";
16 my $confignets = "${General::swroot}/fwhosts/customnetworks";
17 my $configgroups = "${General::swroot}/fwhosts/customgroups";
18 my $ovpnsettings = "${General::swroot}/ovpn/settings";
19 my $ovpnconfig = "${General::swroot}/ovpn/ovpnconfig";
20 my $ccdconfig = "${General::swroot}/ovpn/ccd.conf";
21 my $fwdfwconfig = "${General::swroot}/forward/config";
22 my $outfwconfig = "${General::swroot}/forward/outgoing";
23 my $fwdfwsettings = "${General::swroot}/forward/settings";
24 my @ipgroups = qx(ls $ipgrouppath);
25 my @macgroups = qx(ls $macgrouppath);
26 my @hostarray=();
27 my %outsettings=();
28 my %hosts=();
29 my %nets=();
30 my %groups=();
31 my %settingsovpn=();
32 my %configovpn=();
33 my %ccdconf=();
34 my %fwconfig=();
35 my %fwconfigout=();
36 my %fwdsettings=();
37 &General::readhash($outfwsettings,\%outsettings);
38
39 &process_groups;
40 &process_rules;
41 &process_p2p;
42 system("/usr/local/bin/forwardfwctrl");
43 sub process_groups
44 {
45 if(! -d "/var/log/converters"){ mkdir("/var/log/converters");}
46 if( -f "/var/log/converters/groups-convert.log"){rmtree("var/log/converters");}
47 open (LOG, ">/var/log/converters/groups-convert.log") or die $!;
48 #IP Group processing
49 foreach my $group (@ipgroups){
50 chomp $group;
51 print LOG "\nProcessing IP-GROUP: $group...\n";
52 open (DATEI, "<$ipgrouppath/$group");
53 my @zeilen = <DATEI>;
54 foreach my $ip (@zeilen){
55 chomp($ip);
56 $ip =~ s/\s//gi;
57 print LOG "Check IP $ip from Group $group ";
58 my $val=&check_ip($ip);
59 if($val){
60 push(@hostarray,$val.",ip");
61 print LOG "-> OK\n";
62 }
63 else{
64 print LOG "-> IP \"$ip\" from group $group not converted (invalid IP) \n";
65 }
66 $val='';
67 }
68 &new_hostgrp($group,'ip');
69 @hostarray=();
70 }
71 $group='';
72 @zeilen=();
73 @hostarray=();
74 #MAC Group processing
75 foreach my $group (@macgroups){
76 chomp $group;
77 print LOG "\nProcessing MAC-GROUP: $group...\n";
78 open (DATEI, "<$macgrouppath/$group");
79 my @zeilen = <DATEI>;
80 foreach my $mac (@zeilen){
81 chomp($mac);
82 $mac =~ s/\s//gi;
83 print LOG "Checking MAC $mac from group $group ";
84 #MAC checking
85 if(&General::validmac($mac)){
86 $val=$mac;
87 }
88 if($val){
89 push(@hostarray,$val.",mac");
90 print LOG "-> OK\n";
91 }
92 else{
93 print LOG "-> Mac $mac from group $group not converted (invalid MAC)\n";
94 }
95 $val='';
96 }
97 &new_hostgrp($group,'mac');
98 @hostarray=();
99 @zeilen=();
100 }
101 close (LOG);
102 }
103 sub check_ip
104 {
105 my $adr=shift;
106 my $a;
107 #ip with subnet in decimal
108 if($adr =~ m/^(\d\d?\d?).(\d\d?\d?).(\d\d?\d?).(\d\d?\d?)\/(\d{1,2})$/){
109 $adr=int($1).".".int($2).".".int($3).".".int($4);
110 my $b = &General::iporsubtodec($5);
111 $a=$adr."/".$b;
112 }elsif($adr =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/){
113 $adr=int($1).".".int($2).".".int($3).".".int($4);
114 if(&General::validip($adr)){
115 $a=$adr."/255.255.255.255";
116 }
117 }
118 if(&General::validipandmask($adr)){
119 $a=&General::iporsubtodec($adr);
120 }
121 return $a;
122 }
123 sub new_hostgrp
124 {
125 &General::readhasharray($confighosts,\%hosts);
126 &General::readhasharray($confignets,\%nets);
127 &General::readhasharray($configgroups,\%groups);
128 my $grp=shift;
129 my $run=shift;
130 my $name; #"converted"
131 my $name2;
132 my $name3; #custom host/custom net
133 foreach my $adr (@hostarray){
134 if($run eq 'ip'){
135 my ($ip,$type) = split(",",$adr);
136 my ($ippart,$subnet) = split("/",$ip);
137 my ($byte1,$byte2,$byte3,$byte4) = split(/\./,$subnet);
138 if($byte4 eq '255'){
139 print LOG "Processing SINGLE HOST $ippart/$subnet from group $grp\n";
140 if(!&check_host($ip)){
141 my $key = &General::findhasharraykey(\%hosts);
142 $name="host ";
143 $name2=$name.$ippart;
144 $name3="Custom Host";
145 $hosts{$key}[0] = $name2;
146 $hosts{$key}[1] = $type;
147 $hosts{$key}[2] = $ip;
148 $hosts{$key}[3] = '';
149 $hosts{$key}[4] = 1;
150 print LOG "->Host (IP) $ip added to custom hosts\n"
151 }else{
152 print LOG "->Host (IP) $ip already exists in custom hosts\n";
153 $name="host ";
154 $name2=$name.$ippart;
155 $name3="Custom Host";
156 }
157 }elsif($byte4 < '255'){
158 print LOG "Processing NETWORK $ippart/$subnet from Group $grp\n";
159 if(!&check_net($ippart,$subnet)){
160 my $netkey = &General::findhasharraykey(\%nets);
161 $name="net ";
162 $name2=$name.$ippart;
163 $name3="Custom Network";
164 $nets{$netkey}[0] = $name2;
165 $nets{$netkey}[1] = $ippart;
166 $nets{$netkey}[2] = $subnet;
167 $nets{$netkey}[3] = '';
168 $nets{$netkey}[4] = 1;
169 print LOG "->Network $ippart/$subnet added to custom networks\n";
170 }else{
171 print LOG "Network $ippart already exists in custom networks\n";
172 $name="net ";
173 $name2=$name.$ippart;
174 $name3="Custom Network";
175 }
176 }
177 if($name2 && !&check_grp($grp,$name2)){
178 my $grpkey = &General::findhasharraykey(\%groups);
179 $groups{$grpkey}[0] = $grp;
180 $groups{$grpkey}[1] = '';
181 $groups{$grpkey}[2] = $name2;
182 $groups{$grpkey}[3] = $name3;
183 $groups{$grpkey}[4] = 0;
184 print LOG "->$name2 added to group $grp\n";
185 }
186 }elsif($run eq 'mac'){
187 #MACRUN
188 my ($mac,$type) = split(",",$adr);
189 print LOG "Processing HOST (MAC) $mac\n";
190 if(!&check_host($mac)){
191 my $key = &General::findhasharraykey(\%hosts);
192 $name="host ";
193 $name2=$name.$mac;
194 $name3="Custom Host";
195 $hosts{$key}[0] = $name2;
196 $hosts{$key}[1] = $type;
197 $hosts{$key}[2] = $mac;
198 $hosts{$key}[3] = '';
199 $hosts{$key}[4] = 1;
200 print LOG "->Host (MAC) $mac added to custom hosts\n";
201 }else{
202 print LOG "->Host (MAC) $mac already exists in custom hosts \n";
203 $name="host ";
204 $name2=$name.$mac;
205 $name3="Custom Host";
206 }
207 if($name2 && !&check_grp($grp,$name2)){
208 my $grpkey = &General::findhasharraykey(\%groups);
209 $groups{$grpkey}[0] = $grp;
210 $groups{$grpkey}[1] = '';
211 $groups{$grpkey}[2] = $name2;
212 $groups{$grpkey}[3] = $name3;
213 $groups{$grpkey}[4] = 0;
214 print LOG "->$name2 added to group $grp\n";
215 }
216 }
217 }
218 @hostarray=();
219 &General::writehasharray($confighosts,\%hosts);
220 &General::writehasharray($configgroups,\%groups);
221 &General::writehasharray($confignets,\%nets);
222
223 }
224 sub check_host
225 {
226 my $ip=shift;
227 foreach my $key (sort keys %hosts)
228 {
229 if($hosts{$key}[2] eq $ip)
230 {
231 return 1;
232 }
233 }
234 return 0;
235 }
236 sub check_net
237 {
238 my $ip=shift;
239 my $sub=shift;
240 foreach my $key (sort keys %nets)
241 {
242 if($nets{$key}[1] eq $ip && $nets{$key}[2] eq $sub)
243 {
244 return 1;
245 }
246 }
247 return 0;
248 }
249 sub check_grp
250 {
251 my $grp=shift;
252 my $value=shift;
253 foreach my $key (sort keys %groups)
254 {
255 if($groups{$key}[0] eq $grp && $groups{$key}[2] eq $value)
256 {
257 return 1;
258 }
259 }
260 return 0;
261 }
262 sub process_rules
263 {
264 my ($type,$action,$active,$grp1,$source,$grp2,$useport,$port,$prot,$grp3,$target,$remark,$log,$time,$time_mon,$time_tue,$time_wed,$time_thu,$time_fri,$time_sat,$time_sun,$time_from,$time_to);
265 &General::readhash($fwdfwsettings,\%fwdsettings);
266 if ($outsettings{'POLICY'} eq 'MODE1'){
267 $fwdfwsettings{'POLICY'}='MODE1';
268 $type='ALLOW';
269 $action='ACCEPT';
270 }elsif($outsettings{'POLICY'} eq 'MODE2'){
271 $fwdsettings{'POLICY'}='MODE2';
272 $type='DENY';
273 $action='DROP';
274 }else{
275 return;
276 }
277 &General::writehash($fwdfwsettings,\%fwdsettings);
278
279 #open LOG
280 if( -f "/var/log/converters/outgoingfw-convert.log"){unlink ("/var/log/converters/outgoingfw-convert.log");}
281 open (LOG, ">/var/log/converters/outgoingfw-convert.log") or die $!;
282 open (DATEI, "<$outgoingrules");
283 my @lines = <DATEI>;
284 foreach my $rule (@lines)
285 {
286 chomp($rule);
287 $port='';
288 print LOG "processing: $rule\n";
289 my @configline=();
290 @configline = split( /\;/, $rule );
291 my @prot=();
292 if($configline[0] eq $type){
293 #some variables we can use from old config
294 if($configline[1] eq 'on'){ $active='ON';}else{$active='';}
295 if($configline[3] eq 'all' && $configline[8] ne ''){
296 push(@prot,"TCP");
297 push(@prot,"UDP");
298 }elsif($configline[3] eq 'all' && $configline[8] eq ''){
299 push(@prot,"");
300 }else{
301 push(@prot,$configline[3]);
302 }
303 if($configline[4] ne ''){
304 $configline[4] =~ s/,/;/g;
305 $remark = $configline[4];
306 }else{$remark = '';}
307 if($configline[9] eq 'Active'){ $log='ON';}else{$log='';}
308 if($configline[10] eq 'on' && $configline[11] eq 'on' && $configline[12] eq 'on' && $configline[13] eq 'on' && $configline[14] eq 'on' && $configline[15] eq 'on' && $configline[16] eq 'on'){
309 if($configline[17] eq '00:00' && $configline[18] eq '00:00'){
310 $time='';
311 }else{
312 $time='ON';
313 }
314 }else{
315 $time='ON';
316 }
317 $time_mon=$configline[10];
318 $time_tue=$configline[11];
319 $time_wed=$configline[12];
320 $time_thu=$configline[13];
321 $time_fri=$configline[14];
322 $time_sat=$configline[15];
323 $time_sun=$configline[16];
324 $time_from=$configline[17];
325 $time_to=$configline[18];
326 ############################################################
327 #sourcepart
328 if ($configline[2] eq 'green') {
329 $grp1='std_net_src';
330 $source='GREEN';
331 }elsif ($configline[2] eq 'orange') {
332 $grp1='std_net_src';
333 $source='ORANGE';
334 }elsif ($configline[2] eq 'red') {
335 $grp1='std_net_src';
336 $source='IPFire';
337 &General::readhash($fwdfwsettings,\%fwdsettings);
338 $fwdsettings{'POLICY1'}=$outsettings{'POLICY'};
339 $fwdsettings{'POLICY'}=$outsettings{'POLICY'};
340 &General::writehash($fwdfwsettings,\%fwdsettings);
341 }elsif ($configline[2] eq 'blue') {
342 $grp1='std_net_src';
343 $source='BLUE';
344 }elsif ($configline[2] eq 'ipsec') {
345 print LOG "-> Rule not converted, ipsec+ interface is obsolet since IPFire 2.7 \n";
346 next;
347 }elsif ($configline[2] eq 'ovpn') {
348 &build_ovpn_grp;
349 $grp1='cust_grp_src';
350 $source='ovpn'
351 }elsif ($configline[2] eq 'ip') {
352 my $z=&check_ip($configline[5]);
353 if($z){
354 my ($ipa,$subn) = split("/",$z);
355 $subn=&General::iporsubtocidr($subn);
356 $grp1='src_addr';
357 $source="$ipa/$subn";
358 }else{
359 print LOG "-> Rule not converted, missing/invalid source ip \"$configline[5]\"\n";
360 next;
361 }
362 }elsif ($configline[2] eq 'mac') {
363 if(&General::validmac($configline[6])){
364 $grp1='src_addr';
365 $source=$configline[6];
366 }else{
367 print LOG"-> Rule not converted, invalid MAC \"$configline[6]\" \n";
368 next;
369 }
370 }elsif ($configline[2] eq 'all') {
371 $grp1='std_net_src';
372 $source='ALL';
373 }else{
374 foreach my $key (sort keys %groups){
375 if($groups{$key}[0] eq $configline[2]){
376 $grp1='cust_grp_src';
377 $source=$configline[2];
378 }
379 }
380 if ($grp1 eq '' || $source eq ''){
381 print LOG "-> Rule not converted, no valid source recognised\n";
382 }
383 }
384 ############################################################
385 #destinationpart
386 if($configline[7] ne ''){
387 my $address=&check_ip($configline[7]);
388 if($address){
389 my ($dip,$dsub) = split("/",$address);
390 $dsub=&General::iporsubtocidr($dsub);
391 $grp2='tgt_addr';
392 $target="$dip/$dsub";
393 }elsif(!$address){
394 my $getwebsiteip=&get_ip_from_domain($configline[7]);
395 if ($getwebsiteip){
396 $grp2='tgt_addr';
397 $target=$getwebsiteip;
398 $remark.=" $configline[7]";
399 }else{
400 print LOG "-> Rule not converted, invalid domain \"$configline[7]\"\n";
401 next;
402 }
403 }
404 }else{
405 $grp2='std_net_tgt';
406 $target='ALL';
407 }
408 if($configline[8] ne '' && $configline[3] ne 'gre' && $configline[3] ne 'esp'){
409 my @values=();
410 my @parts=split(",",$configline[8]);
411 foreach (@parts){
412 $_=~ tr/-/:/;
413 if (!($_ =~ /^(\d+)\:(\d+)$/)) {
414 if(&General::validport($_)){
415 $useport='ON';
416 push (@values,$_);
417 $grp3='TGT_PORT';
418 }else{
419 print LOG "-> Rule not converted, invalid destination Port \"$configline[8]\"\n";
420 next;
421 }
422 }else{
423 my ($a1,$a2) = split(/\:/,$_);
424 if (&General::validport($a1) && &General::validport($a2) && $a1 < $a2){
425 $useport='ON';
426 push (@values,"$a1:$a2");
427 $grp3='TGT_PORT';
428 }else{
429 print LOG "-> Rule not converted, invalid destination Port \"$configline[8]\"\n";
430 next;
431 }
432 }
433 }
434 $port=join("|",@values);
435 @values=();
436 @parts=();
437 }
438 }else{
439 print LOG "-> Rule not converted because not for Firewall mode $outsettings{'POLICY'} (we are only converting for actual mode)\n";
440 }
441 &General::readhasharray($fwdfwconfig,\%fwconfig);
442 &General::readhasharray($outfwconfig,\%fwconfigout);
443 my $check;
444 my $chain;
445 foreach my $protocol (@prot){
446 if ($source eq 'IPFire'){
447 $chain='OUTGOINGFW';
448 }else{
449 $chain='FORWARDFW';
450 }
451 $protocol=uc($protocol);
452 print LOG "-> Converted: $action,$chain,$active,$grp1,$source,$grp2,$target,,,,,$useport,$protocol,,$grp3,$port,$remark,$log,$time,$time_mon,$time_tue,$time_wed,$time_thu,$time_fri,$time_sat,$time_sun,$time_from,$time_to\n";
453 #Put rules into system....
454 ###########################
455 #check for double rules
456 foreach my $key (sort keys %fwconfig){
457 if("$action,$chain,$active,$grp1,$source,$grp2,$target,,,,,$useport,$protocol,,$grp3,$port,$remark,$log,$time,$time_mon,$time_tue,$time_wed,$time_thu,$time_fri,$time_sat,$time_sun,$time_from,$time_to"
458 eq "$fwconfig{$key}[0],$fwconfig{$key}[1],$fwconfig{$key}[2],$fwconfig{$key}[3],$fwconfig{$key}[4],$fwconfig{$key}[5],$fwconfig{$key}[6],,,,,$fwconfig{$key}[11],$fwconfig{$key}[12],,$fwconfig{$key}[14],$fwconfig{$key}[15],$fwconfig{$key}[16],$fwconfig{$key}[17],$fwconfig{$key}[18],$fwconfig{$key}[19],$fwconfig{$key}[20],$fwconfig{$key}[21],$fwconfig{$key}[22],$fwconfig{$key}[23],$fwconfig{$key}[24],$fwconfig{$key}[25],$fwconfig{$key}[26],$fwconfig{$key}[27]"){
459 $check='on';
460 next;
461 }
462 }
463 if($check ne 'on'){
464 #increase groupcounter
465 my $check1;
466 if($grp1 eq 'cust_grp_src'){
467 foreach my $key (sort keys %groups){
468 if($groups{$key}[0] eq $source){
469 $groups{$key}[4]++;
470 $check1='on';
471 }
472 }
473 if($check1 eq 'on'){
474 &General::writehasharray($configgroups,\%groups);
475 }
476 }
477 if ($chain eq 'FORWARDFW'){
478 my $key = &General::findhasharraykey(\%fwconfig);
479 $fwconfig{$key}[0] = $action;
480 $fwconfig{$key}[1] = $chain;
481 $fwconfig{$key}[2] = $active;
482 $fwconfig{$key}[3] = $grp1;
483 $fwconfig{$key}[4] = $source;
484 $fwconfig{$key}[5] = $grp2;
485 $fwconfig{$key}[6] = $target;
486 $fwconfig{$key}[11] = $useport;
487 $fwconfig{$key}[12] = $protocol;
488 $fwconfig{$key}[14] = $grp3;
489 $fwconfig{$key}[15] = $port;
490 $fwconfig{$key}[16] = $remark;
491 $fwconfig{$key}[17] = $log;
492 $fwconfig{$key}[18] = $time;
493 $fwconfig{$key}[19] = $time_mon;
494 $fwconfig{$key}[20] = $time_tue;
495 $fwconfig{$key}[21] = $time_wed;
496 $fwconfig{$key}[22] = $time_thu;
497 $fwconfig{$key}[23] = $time_fri;
498 $fwconfig{$key}[24] = $time_sat;
499 $fwconfig{$key}[25] = $time_sun;
500 $fwconfig{$key}[26] = $time_from;
501 $fwconfig{$key}[27] = $time_to;
502 }else{
503 my $key = &General::findhasharraykey(\%fwconfigout);
504 $fwconfigout{$key}[0] = $action;
505 $fwconfigout{$key}[1] = $chain;
506 $fwconfigout{$key}[2] = $active;
507 $fwconfigout{$key}[3] = $grp1;
508 $fwconfigout{$key}[4] = $source;
509 $fwconfigout{$key}[5] = $grp2;
510 $fwconfigout{$key}[6] = $target;
511 $fwconfigout{$key}[11] = $useport;
512 $fwconfigout{$key}[12] = $protocol;
513 $fwconfigout{$key}[14] = $grp3;
514 $fwconfigout{$key}[15] = $port;
515 $fwconfigout{$key}[16] = $remark;
516 $fwconfigout{$key}[17] = $log;
517 $fwconfigout{$key}[18] = $time;
518 $fwconfigout{$key}[19] = $time_mon;
519 $fwconfigout{$key}[20] = $time_tue;
520 $fwconfigout{$key}[21] = $time_wed;
521 $fwconfigout{$key}[22] = $time_thu;
522 $fwconfigout{$key}[23] = $time_fri;
523 $fwconfigout{$key}[24] = $time_sat;
524 $fwconfigout{$key}[25] = $time_sun;
525 $fwconfigout{$key}[26] = $time_from;
526 $fwconfigout{$key}[27] = $time_to;
527 }
528 &General::writehasharray($fwdfwconfig,\%fwconfig);
529 &General::writehasharray($outfwconfig,\%fwconfigout);
530 }
531 }
532 @prot=();
533 }
534 close(LOG);
535 @lines=();
536 }
537 sub get_ip_from_domain
538 {
539 $web=shift;
540 my $resolvedip;
541 my $checked;
542 my ($name,$aliases,$addrtype,$length,@addrs) = gethostbyname($web);
543 if(@addrs){
544 $resolvedip=inet_ntoa($addrs[0]);
545 return $resolvedip;
546 }
547 return;
548 }
549 sub build_ovpn_grp
550 {
551 &General::readhasharray($confighosts,\%hosts);
552 &General::readhasharray($confignets,\%nets);
553 &General::readhasharray($configgroups,\%groups);
554 &General::readhasharray($ovpnconfig,\%configovpn);
555 &General::readhasharray($ccdconfig,\%ccdconf);
556 &General::readhash($ovpnsettings,\%settingsovpn);
557 #get ovpn nets
558 my @ovpnnets=();
559 if($settingsovpn{'DOVPN_SUBNET'}){
560 my ($net,$subnet)=split("/",$settingsovpn{'DOVPN_SUBNET'});
561 push (@ovpnnets,"$net,$subnet,dynamic");
562 }
563 foreach my $key (sort keys %ccdconf){
564 my ($net,$subnet)=split("/",$ccdconf{$key}[1]);
565 $subnet=&General::iporsubtodec($subnet);
566 push (@ovpnnets,"$net,$subnet,$ccdconf{$key}[0]");
567 }
568 foreach my $key (sort keys %configovpn){
569 if ($configovpn{$key}[3] eq 'net'){
570 my ($net,$subnet)=split("/",$configovpn{$key}[27]);
571 push (@ovpnnets,"$net,$subnet,$configovpn{$key}[2]");
572 }
573 }
574 #add ovpn nets to customnetworks/groups
575 foreach my $line (@ovpnnets){
576 my ($net,$subnet,$name) = split(",",$line);
577 if (!&check_net($net,$subnet)){
578 my $netkey = &General::findhasharraykey(\%nets);
579 $name2=$name."(ovpn)".$net;
580 $name3="Custom Network";
581 $nets{$netkey}[0] = $name2;
582 $nets{$netkey}[1] = $net;
583 $nets{$netkey}[2] = $subnet;
584 $nets{$netkey}[3] = 1;
585 }else{
586 print LOG "-> Custom Network with same IP already exist \"$net/$subnet\" (you can ignore this, if this run was manual from shell)\n";
587 }
588 if($name2){
589 my $grpkey = &General::findhasharraykey(\%groups);
590 $groups{$grpkey}[0] = "ovpn";
591 $groups{$grpkey}[1] = '';
592 $groups{$grpkey}[2] = $name2;
593 $groups{$grpkey}[3] = "Custom Network";
594 $groups{$grpkey}[4] = 0;
595 }
596 $name2='';
597 }
598 @ovpnnets=();
599 &General::writehasharray($confighosts,\%hosts);
600 &General::writehasharray($configgroups,\%groups);
601 &General::writehasharray($confignets,\%nets);
602 }
603 sub process_p2p
604 {
605 copy("/var/ipfire/outgoing/p2protocols","/var/ipfire/forward/p2protocols");
606 chmod oct('0777'), '/var/ipfire/forward/p2protocols';
607 }