]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - html/cgi-bin/ovpnmain.cgi
Re-apply: OpenVPN: Fix daemon stuck in WAIT state.
[people/teissler/ipfire-2.x.git] / html / cgi-bin / ovpnmain.cgi
index 0c9e73d5b86b9662d9315c0e3828626379e18214..8390be05846184a5a5add02af36440b8a3d23c8a 100644 (file)
@@ -93,7 +93,6 @@ $cgiparams{'PMTU_DISCOVERY'} = '';
 $cgiparams{'DCIPHER'} = '';
 $cgiparams{'DAUTH'} = '';
 $cgiparams{'TLSAUTH'} = '';
-$cgiparams{'ENGINES'} = '';
 $routes_push_file = "${General::swroot}/ovpn/routes_push";
 unless (-e $routes_push_file)    { system("touch $routes_push_file"); }
 unless (-e "${General::swroot}/ovpn/ccd.conf")    { system("touch ${General::swroot}/ovpn/ccd.conf"); }
@@ -228,6 +227,51 @@ sub checkportinc
        }
 }
 
+# Darren Critchley - certain ports are reserved for IPFire
+# TCP 67,68,81,222,444
+# UDP 67,68
+# Params passed in -> port, rangeyn, protocol
+sub disallowreserved
+{
+       # port 67 and 68 same for tcp and udp, don't bother putting in an array
+       my $msg = "";
+       my @tcp_reserved = (81,222,444);
+       my $prt = $_[0]; # the port or range
+       my $ryn = $_[1]; # tells us whether or not it is a port range
+       my $prot = $_[2]; # protocol
+       my $srcdst = $_[3]; # source or destination
+       if ($ryn) { # disect port range
+               if ($srcdst eq "src") {
+                       $msg = "$Lang::tr{'rsvd src port overlap'}";
+               } else {
+                       $msg = "$Lang::tr{'rsvd dst port overlap'}";
+               }
+               my @tmprng = split(/\:/,$prt);
+               unless (67 < $tmprng[0] || 67 > $tmprng[1]) { $errormessage="$msg 67"; return; }
+               unless (68 < $tmprng[0] || 68 > $tmprng[1]) { $errormessage="$msg 68"; return; }
+               if ($prot eq "tcp") {
+                       foreach my $prange (@tcp_reserved) {
+                               unless ($prange < $tmprng[0] || $prange > $tmprng[1]) { $errormessage="$msg $prange"; return; }
+                       }
+               }
+       } else {
+               if ($srcdst eq "src") {
+                       $msg = "$Lang::tr{'reserved src port'}";
+               } else {
+                       $msg = "$Lang::tr{'reserved dst port'}";
+               }
+               if ($prt == 67) { $errormessage="$msg 67"; return; }
+               if ($prt == 68) { $errormessage="$msg 68"; return; }
+               if ($prot eq "tcp") {
+                       foreach my $prange (@tcp_reserved) {
+                               if ($prange == $prt) { $errormessage="$msg $prange"; return; }
+                       }
+               }
+       }
+       return;
+}
+
+
 sub writeserverconf {
     my %sovpnsettings = ();  
     my @temp = ();  
@@ -256,7 +300,7 @@ sub writeserverconf {
     my @tempovpnsubnet = split("\/",$sovpnsettings{'DOVPN_SUBNET'});
     print CONF "server $tempovpnsubnet[0] $tempovpnsubnet[1]\n";
     #print CONF "push \"route $netsettings{'GREEN_NETADDRESS'} $netsettings{'GREEN_NETMASK'}\"\n";
-   
+
     # Check if we are using mssfix, fragment or mtu-disc and set the corretct mtu of 1500.
     # If we doesn't use one of them, we can use the configured mtu value.
     if ($sovpnsettings{'MSSFIX'} eq 'on') 
@@ -264,8 +308,8 @@ sub writeserverconf {
     elsif ($sovpnsettings{'FRAGMENT'} ne '' && $sovpnsettings{'DPROTOCOL'} ne 'tcp') 
        { print CONF "$sovpnsettings{'DDEVICE'}-mtu 1500\n"; }
     elsif (($sovpnsettings{'PMTU_DISCOVERY'} eq 'yes') ||
-          ($sovpnsettings{'PMTU_DISCOVERY'} eq 'maybe') ||
-          ($sovpnsettings{'PMTU_DISCOVERY'} eq 'no' ))
+       ($sovpnsettings{'PMTU_DISCOVERY'} eq 'maybe') ||
+       ($sovpnsettings{'PMTU_DISCOVERY'} eq 'no' ))
        { print CONF "$sovpnsettings{'DDEVICE'}-mtu 1500\n"; } 
     else 
        { print CONF "$sovpnsettings{'DDEVICE'}-mtu $sovpnsettings{'DMTU'}\n"; }
@@ -300,10 +344,10 @@ sub writeserverconf {
        print CONF "client-to-client\n";
     }
     if ($sovpnsettings{MSSFIX} eq 'on') {
-       print CONF "mssfix\n";
+               print CONF "mssfix\n";
     }
     if ($sovpnsettings{FRAGMENT} ne '' && $sovpnsettings{'DPROTOCOL'} ne 'tcp') {
-       print CONF "fragment $sovpnsettings{'FRAGMENT'}\n";   
+               print CONF "fragment $sovpnsettings{'FRAGMENT'}\n";
     }
 
     # Check if a valid operating mode has been choosen and use it.
@@ -327,11 +371,6 @@ sub writeserverconf {
     if ($sovpnsettings{'TLSAUTH'} eq 'on') {
        print CONF "tls-auth ${General::swroot}/ovpn/ca/ta.key 0\n";
     }
-    if ($sovpnsettings{ENGINES} eq 'disabled') {
-       print CONF "";
-    } else {
-       print CONF "engine $sovpnsettings{ENGINES}\n";
-    }
     if ($sovpnsettings{DCOMPLZO} eq 'on') {
         print CONF "comp-lzo\n";
     }
@@ -528,7 +567,7 @@ sub getccdadresses
        my @iprange=();
        my %ccdhash=();
        &General::readhasharray("${General::swroot}/ovpn/ovpnconfig", \%ccdhash);
-       $iprange[0]=$ip1.".".$ip2.".".$ip3.".".($ip4+2);
+       $iprange[0]=$ip1.".".$ip2.".".$ip3.".".2;
        for (my $i=1;$i<=$count;$i++) {
                my $tmpip=$iprange[$i-1];
                my $stepper=$i*4;
@@ -752,7 +791,6 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'save-adv-options'}) {
     $vpnsettings{'PMTU_DISCOVERY'} = $cgiparams{'PMTU_DISCOVERY'};
     $vpnsettings{'DAUTH'} = $cgiparams{'DAUTH'};
     $vpnsettings{'TLSAUTH'} = $cgiparams{'TLSAUTH'};
-    $vpnsettings{'ENGINES'} = $cgiparams{'ENGINES'};
     my @temp=();
     
     if ($cgiparams{'FRAGMENT'} eq '') {
@@ -964,12 +1002,6 @@ unless(-d "${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}"){mkdir "${General
        print SERVERCONF "# HMAC algorithm\n";
        print SERVERCONF "auth $cgiparams{'DAUTH'}\n";
   }
-  if ($cgiparams{'ENGINES'} eq 'disabled') {
-       print SERVERCONF "";
-  } else {
-       print SERVERCONF "# Crypto engine\n";
-       print SERVERCONF "engine $cgiparams{'ENGINES'}\n";
-  }
   if ($cgiparams{'COMPLZO'} eq 'on') {
    print SERVERCONF "# Enable Compression\n";
    print SERVERCONF "comp-lzo\r\n";
@@ -994,6 +1026,7 @@ unless(-d "${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}"){mkdir "${General
 
 if ($cgiparams{'ACTION'} eq $Lang::tr{'save'} && $cgiparams{'TYPE'} eq 'net' && $cgiparams{'SIDE'} eq 'client')
 {
+
         my @ovsubnettemp =  split(/\./,$cgiparams{'OVPN_SUBNET'});
         my $ovsubnet =  "$ovsubnettemp[0].$ovsubnettemp[1].$ovsubnettemp[2]";
         my @remsubnet =  split(/\//,$cgiparams{'REMOTE_SUBNET'});
@@ -1064,16 +1097,10 @@ unless(-d "${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}"){mkdir "${General
        print CLIENTCONF "# HMAC algorithm\n";
        print CLIENTCONF "auth $cgiparams{'DAUTH'}\n";
   }
-  if ($cgiparams{'ENGINES'} eq 'disabled') {
-       print CLIENTCONF "";
-  } else {
-       print CLIENTCONF "# Crypto engine\n";
-       print CLIENTCONF "engine $cgiparams{'ENGINES'}\n";
-  }
   if ($cgiparams{'COMPLZO'} eq 'on') {
    print CLIENTCONF "# Enable Compression\n";
    print CLIENTCONF "comp-lzo\r\n";
-     }
+  }
   print CLIENTCONF "# Debug Level\n"; 
   print CLIENTCONF "verb 3\n"; 
   print CLIENTCONF "# Tunnel check\n"; 
@@ -1112,7 +1139,7 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'save'} && $cgiparams{'TYPE'} eq '' && $cg
     
     if (! &General::validipandmask($cgiparams{'DOVPN_SUBNET'})) {
             $errormessage = $Lang::tr{'ovpn subnet is invalid'};
-       goto SETTINGS_ERROR;
+                       goto SETTINGS_ERROR;
     }
     my @tmpovpnsubnet = split("\/",$cgiparams{'DOVPN_SUBNET'});
     
@@ -1211,7 +1238,7 @@ SETTINGS_ERROR:
     while ($file = glob("${General::swroot}/ovpn/crls/*")) {
        unlink $file;
     }
-    &cleanssldatabase();
+       &cleanssldatabase();
     if (open(FILE, ">${General::swroot}/ovpn/caconfig")) {
         print FILE "";
         close FILE;
@@ -1263,7 +1290,6 @@ SETTINGS_ERROR:
                        </tr>
                </table>
        </form>
-
 END
     ;
     &Header::closebox();
@@ -1298,7 +1324,7 @@ END
        print <<END;
        <table width='100%'>
        <tr>
-               <td width='15%'> </td> <td width='15%'></td> <td width='65%'></td>
+               <td width='20%'> </td> <td width='15%'></td> <td width='65%'></td>
        </tr>
        <tr>
                <td class='base'>$Lang::tr{'ovpn dh'}:</td>
@@ -1387,7 +1413,7 @@ END
 
     if ($cgiparams{'CA_NAME'} eq 'ca') {
        $errormessage = $Lang::tr{'name is invalid'};
-       goto UPLOAD_CA_ERROR;
+       goto UPLOADCA_ERROR;
     }
 
     # Check if there is no other entry with this name
@@ -2008,7 +2034,8 @@ END
            <td><input type='submit' name='ACTION' value='$Lang::tr{'upload p12 file'}' /></td>
             <td colspan='2'>&nbsp;</td></tr>
        <tr><td class='base' colspan='4' align='left'>
-           <img src='/blob.gif' valign='top' al='*' >&nbsp;$Lang::tr{'this field may be blank'}</td></tr>
+           <img src='/blob.gif' valign='top' al='*' >&nbsp;$Lang::tr{'this field may be blank'}</td>
+       </tr>
        </form></table>
 END
        ;
@@ -2467,19 +2494,22 @@ if ($confighash{$cgiparams{'KEY'}}[3] eq 'net') {
 #    }
 ADV_ERROR:
     if ($cgiparams{'MAX_CLIENTS'} eq '') {
-       $cgiparams{'MAX_CLIENTS'} =  '100';     
+               $cgiparams{'MAX_CLIENTS'} =  '100';
     }
     if ($cgiparams{'KEEPALIVE_1'} eq '') {
-       $cgiparams{'KEEPALIVE_1'} =  '10';     
+               $cgiparams{'KEEPALIVE_1'} =  '10';
     }
     if ($cgiparams{'KEEPALIVE_2'} eq '') {
-       $cgiparams{'KEEPALIVE_2'} =  '60';     
+               $cgiparams{'KEEPALIVE_2'} =  '60';
     }
     if ($cgiparams{'LOG_VERB'} eq '') {
-       $cgiparams{'LOG_VERB'} =  '3';
+               $cgiparams{'LOG_VERB'} =  '3';
     }
     if ($cgiparams{'PMTU_DISCOVERY'} eq '') {
-       $cgiparams{'PMTU_DISCOVERY'} = 'off';
+               $cgiparams{'PMTU_DISCOVERY'} = 'off';
+    }
+    if ($cgiparams{'DAUTH'} eq '') {
+               $cgiparams{'DAUTH'} = 'SHA1';
     }
     if ($cgiparams{'DAUTH'} eq '') {
        $cgiparams{'DAUTH'} = 'SHA1';
@@ -2490,6 +2520,12 @@ ADV_ERROR:
     if ($cgiparams{'TLSAUTH'} eq '') {
        $cgiparams{'TLSAUTH'} = 'off';
     }
+    if ($cgiparams{'DAUTH'} eq '') {
+       $cgiparams{'DAUTH'} = 'SHA1';
+    }
+    if ($cgiparams{'TLSAUTH'} eq '') {
+       $cgiparams{'TLSAUTH'} = 'off';
+    }
     $checked{'CLIENT2CLIENT'}{'off'} = '';
     $checked{'CLIENT2CLIENT'}{'on'} = '';
     $checked{'CLIENT2CLIENT'}{$cgiparams{'CLIENT2CLIENT'}} = 'CHECKED';
@@ -2522,12 +2558,6 @@ ADV_ERROR:
     $checked{'TLSAUTH'}{'off'} = '';
     $checked{'TLSAUTH'}{'on'} = '';
     $checked{'TLSAUTH'}{$cgiparams{'TLSAUTH'}} = 'CHECKED';
-    $selected{'ENGINES'}{'cryptodev'} = '';
-    $selected{'ENGINES'}{'dynamic'} = '';
-    $selected{'ENGINES'}{'aesni'} = '';
-    $selected{'ENGINES'}{'padlock'} = '';
-    $selected{'ENGINES'}{'disabled'} = '';
-    $selected{'ENGINES'}{$cgiparams{'ENGINES'}} = 'SELECTED';
    
     &Header::showhttpheaders();
     &Header::openpage($Lang::tr{'status ovpn'}, 1, '');
@@ -2541,32 +2571,32 @@ ADV_ERROR:
     &Header::openbox('100%', 'LEFT', $Lang::tr{'advanced server'});
     print <<END;
     <form method='post' enctype='multipart/form-data'>
-    <table width='100%' border='0'>
-    <tr>
-       <td colspan='4'><b>$Lang::tr{'dhcp-options'}</b></td>
+<table width='100%' border=0>
+       <tr>
+               <td colspan='4'><b>$Lang::tr{'dhcp-options'}</b></td>
     </tr>
     <tr>
-       <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
+               <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
     </tr>      
     <tr>               
-       <td class='base'>Domain</td>
+               <td class='base'>Domain</td>
         <td><input type='TEXT' name='DHCP_DOMAIN' value='$cgiparams{'DHCP_DOMAIN'}' size='30'  /></td>
     </tr>
     <tr>       
-       <td class='base'>DNS</td>
-       <td><input type='TEXT' name='DHCP_DNS' value='$cgiparams{'DHCP_DNS'}' size='30' /></td>
+               <td class='base'>DNS</td>
+               <td><input type='TEXT' name='DHCP_DNS' value='$cgiparams{'DHCP_DNS'}' size='30' /></td>
     </tr>      
     <tr>       
-       <td class='base'>WINS</td>
-       <td><input type='TEXT' name='DHCP_WINS' value='$cgiparams{'DHCP_WINS'}' size='30' /></td>
-       </tr>
+               <td class='base'>WINS</td>
+               <td><input type='TEXT' name='DHCP_WINS' value='$cgiparams{'DHCP_WINS'}' size='30' /></td>
+       </tr>
     <tr>
-       <td colspan='4'><b>$Lang::tr{'ovpn routes push options'}</b></td>
+               <td colspan='4'><b>$Lang::tr{'ovpn routes push options'}</b></td>
     </tr>
     <tr>       
-       <td class='base'>$Lang::tr{'ovpn routes push'}</td>
-  <td colspan='2'>
-       <textarea name='ROUTES_PUSH' cols='26' rows='6' wrap='off'>
+               <td class='base'>$Lang::tr{'ovpn routes push'}</td>
+               <td colspan='2'>
+               <textarea name='ROUTES_PUSH' cols='26' rows='6' wrap='off'>
 END
 ;
 
@@ -2581,32 +2611,32 @@ print <<END;
     </tr>
 </table>
 <hr size='1'>
-    <table width='100%'>
+<table width='100%'>
     <tr>
-       <td class'base'><b>$Lang::tr{'misc-options'}</b></td>
+               <td class'base'><b>$Lang::tr{'misc-options'}</b></td>
     </tr>
     <tr>
-       <td width='20%'></td> <td width='15%'> </td><td width='15%'> </td><td width='15%'></td><td width='35%'></td>
+               <td width='20%'></td> <td width='15%'> </td><td width='15%'> </td><td width='15%'></td><td width='35%'></td>
     </tr>
     <tr>
-       <td class='base'>Client-To-Client</td>
-       <td><input type='checkbox' name='CLIENT2CLIENT' $checked{'CLIENT2CLIENT'}{'on'} /></td>
+               <td class='base'>Client-To-Client</td>
+               <td><input type='checkbox' name='CLIENT2CLIENT' $checked{'CLIENT2CLIENT'}{'on'} /></td>
     </tr>
     <tr>       
-       <td class='base'>Redirect-Gateway def1</td>
-       <td><input type='checkbox' name='REDIRECT_GW_DEF1' $checked{'REDIRECT_GW_DEF1'}{'on'} /></td>
+               <td class='base'>Redirect-Gateway def1</td>
+               <td><input type='checkbox' name='REDIRECT_GW_DEF1' $checked{'REDIRECT_GW_DEF1'}{'on'} /></td>
     </tr>
     <tr>       
         <td class='base'>Max-Clients</td>
         <td><input type='text' name='MAX_CLIENTS' value='$cgiparams{'MAX_CLIENTS'}' size='10' /></td>
     </tr>      
-       <tr>
+       <tr>
          <td class='base'>Keepalive <br />
            (ping/ping-restart)</td>
          <td><input type='TEXT' name='KEEPALIVE_1' value='$cgiparams{'KEEPALIVE_1'}' size='10' /></td>
          <td><input type='TEXT' name='KEEPALIVE_2' value='$cgiparams{'KEEPALIVE_2'}' size='10' /></td>
     </tr>
-       <tr>
+       <tr>
          <td class='base'>fragment <br></td>
          <td><input type='TEXT' name='FRAGMENT' value='$cgiparams{'FRAGMENT'}' size='10' /></td>
       </tr>
@@ -2626,7 +2656,7 @@ print <<END;
 </table>
 
 <hr size='1'>
-    <table width='100%'>
+<table width='100%'>
     <tr>
        <td class'base'><b>$Lang::tr{'log-options'}</b></td>
     </tr>
@@ -2670,18 +2700,6 @@ print <<END;
                </td>
                <td>Default: <span class="base">SHA1 (160 $Lang::tr{'bit'})</span></td>
     </tr>
-
-    <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'ovpn engines'}</td>
-               <td><select name='ENGINES'>
-                               <option value='cryptodev'               $selected{'ENGINES'}{'cryptodev'}>Cryptodev</option>
-                               <option value='dynamic'                 $selected{'ENGINES'}{'dynamic'}>Dynamic</option>
-                               <option value='aesni'                   $selected{'ENGINES'}{'aesni'}>AES-NI</option>
-                               <option value='padlock'                 $selected{'ENGINES'}{'padlock'}>Padlock</option>
-                               <option value='disabled'                $selected{'ENGINES'}{'disabled'}>$Lang::tr{'disabled'}</option>
-                       </select>
-               </td>
-               <td>Default: <span class="base">$Lang::tr{'disabled'}</span></td>
-       </tr>
 </table>
 
 <table width='100%'>
@@ -2694,8 +2712,6 @@ print <<END;
        <td><input type='checkbox' name='TLSAUTH' $checked{'TLSAUTH'}{'on'} /></td>
     </tr>
     </table><hr>
-
-
 END
 
 if ( -e "/var/run/openvpn.pid"){
@@ -2777,7 +2793,7 @@ if ($cgiparams{'ACTION'} eq "edit"){
     <table width='100%' border='0'>
     <tr><form method='post'>
        <td width='10%' nowrap='nowrap'>$Lang::tr{'ccd name'}:</td><td><input type='TEXT' name='ccdname' value='$cgiparams{'ccdname'}' /></td>
-       <td width='8%'>$Lang::tr{'ccd subnet'}:</td><td><input type='TEXT' name='ccdsubnet' value='$cgiparams{'ccdsubnet'}' readonly='readonly' /></td></tr>
+       <td width='8%'>$Lang::tr{'ccd subnet'}:</td><td><input type='TEXT' name='ccdsubnet' value='$cgiparams{'ccdsubnet'}' readonly /></td></tr>
        <tr><td colspan='4' align='right'><hr><input type='submit' value='$Lang::tr{'save'}' /><input type='hidden' name='ACTION' value='editsave'/>
        <input type='hidden' name='ccdname' value='$cgiparams{'ccdname'}'/><input type='submit' value='$Lang::tr{'cancel'}' />
        </td></tr>
@@ -2817,7 +2833,7 @@ END
                print "$Lang::tr{'ccd noaddnet'}<br><hr>";
        }
        
-       print <<END
+    print <<END;
     <table width='100%' cellpadding='0' cellspacing='1'>
     <tr>
        <td class='boldbase' align='center' nowrap='nowrap' width='20%'><b>$Lang::tr{'ccd name'}</td><td class='boldbase' align='center' width='8%'><b>$Lang::tr{'network'}</td><td class='boldbase' width='8%' align='center' nowrap='nowrap'><b>$Lang::tr{'ccd used'}</td><td width='1%' align='center'></td><td width='1%' align='center'></td></tr>
@@ -2835,9 +2851,9 @@ END
                if ($count % 2){ print" <tr bgcolor='$color{'color22'}'>";}
                else{            print" <tr bgcolor='$color{'color20'}'>";}
                print"<td>$ccdconf[0]</td><td align='center'>$ccdconf[1]</td><td align='center'>$ccdhosts/".(&ccdmaxclients($ccdconf[1])+1)."</td><td>";
-print <<END
+        print <<END;
                <form method='post' />
-               <input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
+               <input type='image' src='/images/edit.gif' align='middle' alt=$Lang::tr{'edit'} title=$Lang::tr{'edit'} />
                <input type='hidden' name='ACTION' value='edit'/>
                <input type='hidden' name='ccdname' value='$ccdconf[0]' />
                <input type='hidden' name='ccdsubnet' value='$ccdconf[1]' />
@@ -2846,7 +2862,7 @@ print <<END
                <td><input type='hidden' name='ACTION' value='kill'/>
                <input type='hidden' name='number' value='$count' />
                <input type='hidden' name='net' value='$ccdconf[0]' />
-               <input type='image' src='/images/delete.gif' align='middle' alt='$Lang::tr{'remove'}' title='$Lang::tr{'remove'}' /></form></td></tr>
+               <input type='image' src='/images/delete.gif' align='middle' alt=$Lang::tr{'remove'} title=$Lang::tr{'remove'} /></form></td></tr>
 END
 ;
        }       
@@ -3076,7 +3092,7 @@ if ( -s "${General::swroot}/ovpn/settings") {
                <td class='base'>$Lang::tr{'net to net vpn'} (Upload Client Package)</td></tr>
          <tr><td>&nbsp;</td><td class='base'><input type='file' name='FH' size='30'></td></tr>
          <tr><td>&nbsp;</td><td>Import Connection Name <img src='/blob.gif' /></td></tr>
-    <tr><td>&nbsp;</td><td class='base'><input type='text' name='n2nname' size='30'>$Lang::tr{'openvpn default'}: Client Packagename</td></tr>
+    <tr><td>&nbsp;</td><td class='base'><input type='text' name='n2nname' size='30'>Default : Client Packagename</td></tr>
          <tr><td colspan='3'><hr /></td></tr>
     <tr><td align='right' colspan='3'><input type='submit' name='ACTION' value='$Lang::tr{'add'}' /></td></tr>
          <tr><td class='base' colspan='3' align='left'><img src='/blob.gif' alt='*' />&nbsp;$Lang::tr{'this field may be blank'}</td></tr>
@@ -3233,6 +3249,7 @@ END
        
 my $complzoactive;
 my $mssfixactive;
+my $authactive;
 my $n2nfragment;
 my $authactive;
 my @n2nmtudisc = split(/ /, (grep { /^mtu-disc/ } @firen2nconf)[0]);
@@ -3253,8 +3270,7 @@ my @n2nremsub = split(/ /, (grep { /^route/ } @firen2nconf)[0]);
 my @n2nmgmt =  split(/ /, (grep { /^management/ } @firen2nconf)[0]);
 my @n2nlocalsub  = split(/ /, (grep { /^# remsub/ } @firen2nconf)[0]);
 my @n2ncipher = split(/ /, (grep { /^cipher/ } @firen2nconf)[0]);
-my @n2nauth = split(/ /, (grep { /^auth/ } @firen2nconf)[0]);
-my @n2nengine = split(/ /, (grep { /^engine/ } @firen2nconf)[0]);;
+my @n2nauth = split(/ /, (grep { /^auth/ } @firen2nconf)[0]);;
 
 ###
 # m.a.d delete CR and LF from arrays for this chomp doesnt work
@@ -3275,7 +3291,6 @@ $n2nmgmt[2] =~ s/\n|\r//g;
 $n2nmtudisc[1] =~ s/\n|\r//g;
 $n2ncipher[1] =~ s/\n|\r//g;
 $n2nauth[1] =~ s/\n|\r//g;
-$n2nengine[1] =~ s/\n|\r//g;
 chomp ($complzoactive);
 chomp ($mssfixactive);
 
@@ -3355,7 +3370,6 @@ foreach my $dkey (keys %confighash) {
        $confighash{$key}[40] = $n2ncipher[1];
        $confighash{$key}[41] = 'disabled';
 
-
   &General::writehasharray("${General::swroot}/ovpn/ovpnconfig", \%confighash);
  
   N2N_ERROR:
@@ -3383,13 +3397,13 @@ foreach my $dkey (keys %confighash) {
                <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'Act as'}</td><td><b>$confighash{$key}[6]</b></td></tr>                                                              
                <tr><td class='boldbase' nowrap='nowrap'>Remote Host </td><td><b>$confighash{$key}[10]</b></td></tr>
                <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'local subnet'}</td><td><b>$confighash{$key}[8]</b></td></tr>
-               <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'remote subnet'}</td><td><b>$confighash{$key}[11]</b></td></tr>
+               <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'remote subnet'}:</td><td><b>$confighash{$key}[11]</b></td></tr>
                <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'ovpn subnet'}</td><td><b>$confighash{$key}[27]</b></td></tr>
                <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'protocol'}</td><td><b>$confighash{$key}[28]</b></td></tr>
                <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'destination port'}:</td><td><b>$confighash{$key}[29]</b></td></tr>
                <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'comp-lzo'}</td><td><b>$confighash{$key}[30]</b></td></tr>
-               <tr><td class='boldbase' nowrap='nowrap'>MSSFIX </td><td><b>$confighash{$key}[23]</b></td></tr>
-               <tr><td class='boldbase' nowrap='nowrap'>Fragment </td><td><b>$confighash{$key}[24]</b></td></tr>
+               <tr><td class='boldbase' nowrap='nowrap'>MSSFIX:</td><td><b>$confighash{$key}[23]</b></td></tr>
+               <tr><td class='boldbase' nowrap='nowrap'>Fragment:</td><td><b>$confighash{$key}[24]</b></td></tr>
                <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'MTU'}</td><td><b>$confighash{$key}[31]</b></td></tr>
                <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'ovpn mtu-disc'}</td><td><b>$confighash{$key}[38]</b></td></tr>
                <tr><td class='boldbase' nowrap='nowrap'>Management Port </td><td><b>$confighash{$key}[22]</b></td></tr>
@@ -3495,7 +3509,6 @@ if ($confighash{$cgiparams{'KEY'}}) {
                $cgiparams{'DAUTH'}             = $confighash{$cgiparams{'KEY'}}[39];
                $cgiparams{'DCIPHER'}           = $confighash{$cgiparams{'KEY'}}[40];
                $cgiparams{'TLSAUTH'}           = $confighash{$cgiparams{'KEY'}}[41];
-               $cgiparams{'ENGINES'}           = $confighash{$cgiparams{'KEY'}}[42];
        } elsif ($cgiparams{'ACTION'} eq $Lang::tr{'save'}) {
        $cgiparams{'REMARK'} = &Header::cleanhtml($cgiparams{'REMARK'});
        
@@ -3805,7 +3818,7 @@ if ($cgiparams{'TYPE'} eq 'net') {
                  goto VPNCONF_ERROR;
                }
 
-       if ($cgiparams{'OVPN_MGMT'} eq  '') {
+       if ($cgiparams{'OVPN_MGMT'} eq '') {
                $cgiparams{'OVPN_MGMT'} = $cgiparams{'DEST_PORT'};              
                }
        
@@ -4221,8 +4234,6 @@ if ($cgiparams{'TYPE'} eq 'net') {
        $confighash{$key}[38]           = $cgiparams{'PMTU_DISCOVERY'};
        $confighash{$key}[39]           = $cgiparams{'DAUTH'};
        $confighash{$key}[40]           = $cgiparams{'DCIPHER'};
-       $confighash{$key}[42]           = $cgiparams{'ENGINES'};
-
 
        &General::writehasharray("${General::swroot}/ovpn/ovpnconfig", \%confighash);
        
@@ -4334,11 +4345,10 @@ if ($cgiparams{'TYPE'} eq 'net') {
         $cgiparams{'FRAGMENT'} = '1300';
        $cgiparams{'PMTU_DISCOVERY'} = 'off';
        $cgiparams{'DAUTH'} = 'SHA1';
-       $cgiparams{'ENGINES'} = 'disabled';
 ###
 # m.a.d n2n end
 ###    
-       $cgiparams{'SIDE'} = 'left';
+        $cgiparams{'SIDE'} = 'left';
        if ( ! -f "${General::swroot}/ovpn/ca/cakey.pem" ) {
            $cgiparams{'AUTH'} = 'psk';
        } elsif ( ! -f "${General::swroot}/ovpn/ca/cacert.pem") {
@@ -4411,10 +4421,7 @@ if ($cgiparams{'TYPE'} eq 'net') {
     $selected{'DCIPHER'}{'DES-EDE-CBC'} = '';
     $selected{'DCIPHER'}{'CAST5-CBC'} = '';
     $selected{'DCIPHER'}{'BF-CBC'} = '';
-    $selected{'DCIPHER'}{'RC2-CBC'} = '';
     $selected{'DCIPHER'}{'DES-CBC'} = '';
-    $selected{'DCIPHER'}{'RC2-64-CBC'} = '';
-    $selected{'DCIPHER'}{'RC2-40-CBC'} = '';
     # If no cipher has been chossen yet, select
     # the old default (AES-256-CBC) for compatiblity reasons.
     if ($cgiparams{'DCIPHER'} eq '') {
@@ -4433,18 +4440,6 @@ if ($cgiparams{'TYPE'} eq 'net') {
     }
     $selected{'DAUTH'}{$cgiparams{'DAUTH'}} = 'SELECTED';
 
-    $selected{'ENGINES'}{'disabled'} = '';
-    $selected{'ENGINES'}{'cryptodev'} = '';
-    $selected{'ENGINES'}{'dynamic'} = '';
-    $selected{'ENGINES'}{'aesni'} = '';
-    $selected{'ENGINES'}{'padlock'} = '';
-    # If no engine has been choosen yet, select
-    # a default one (disabled).
-    if ($cgiparams{'ENGINES'} eq '') {
-        $cgiparams{'ENGINES'} = 'disabled';
-    }
-    $selected{'ENGINES'}{$cgiparams{'ENGINES'}} = 'SELECTED';
-
     if (1) {
        &Header::showhttpheaders();
        &Header::openpage($Lang::tr{'ovpn'}, 1, '');
@@ -4473,28 +4468,25 @@ if ($cgiparams{'TYPE'} eq 'net') {
 
        &Header::openbox('100%', 'LEFT', "$Lang::tr{'connection'}:");
        print "<table width='100%'  border='0'>\n";
-       
-       
-       
+
        print "<tr><td width='14%' class='boldbase'>$Lang::tr{'name'}: </td>";
        
        if ($cgiparams{'TYPE'} eq 'host') {
            if ($cgiparams{'KEY'}) {
                print "<td width='35%' class='base'><input type='hidden' name='NAME' value='$cgiparams{'NAME'}' />$cgiparams{'NAME'}</td>";
            } else {
-                       
                print "<td width='35%'><input type='text' name='NAME' value='$cgiparams{'NAME'}' maxlength='20' size='30' /></td>";
            }
 #          print "<tr><td>$Lang::tr{'interface'}</td>";
 #          print "<td><select name='INTERFACE'>";
 #          print "<option value='RED' $selected{'INTERFACE'}{'RED'}>RED</option>";
-#          if ($netsettings{'BLUE_DEV'} ne '') {
-#              print "<option value='BLUE' $selected{'INTERFACE'}{'BLUE'}>BLUE</option>";
-#          }
-#          print "<option value='GREEN' $selected{'INTERFACE'}{'GREEN'}>GREEN</option>";
-#          print "<option value='ORANGE' $selected{'INTERFACE'}{'ORANGE'}>ORANGE</option>";
-#          print "</select></td></tr>";
-#          print <<END
+#              if ($netsettings{'BLUE_DEV'} ne '') {
+#                      print "<option value='BLUE' $selected{'INTERFACE'}{'BLUE'}>BLUE</option>";
+#              }
+#              print "<option value='GREEN' $selected{'INTERFACE'}{'GREEN'}>GREEN</option>";
+#              print "<option value='ORANGE' $selected{'INTERFACE'}{'ORANGE'}>ORANGE</option>";
+#              print "</select></td></tr>";
+#              print <<END;
        } else {
            print "<input type='hidden' name='INTERFACE' value='red' />";
            if ($cgiparams{'KEY'}) {
@@ -4502,104 +4494,68 @@ if ($cgiparams{'TYPE'} eq 'net') {
            } else {
                print "<td width='25%'><input type='text' name='NAME' value='$cgiparams{'NAME'}' maxlength='20' /></td>";
            }
-           
-           
-           
            print <<END;
                    <td width='25%'>&nbsp;</td>
-                   <td width='25%'>&nbsp;</td></tr>
-               <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'Act as'}</td>
-                   <td><select name='SIDE'><option value='server' $selected{'SIDE'}{'server'}>$Lang::tr{'openvpn server'}</option>
-                                           <option value='client' $selected{'SIDE'}{'client'}>$Lang::tr{'openvpn client'}</option></select></td>
-
-                   <td class='boldbase'>$Lang::tr{'remote host/ip'}:</td>
-                   <td><input type='TEXT' name='REMOTE' value='$cgiparams{'REMOTE'}' /></td></tr>
-
-               <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'local subnet'}</td>
-                   <td><input type='TEXT' name='LOCAL_SUBNET' value='$cgiparams{'LOCAL_SUBNET'}' /></td>
-
-                   <td class='boldbase' nowrap='nowrap'>$Lang::tr{'remote subnet'}</td>
-                   <td><input type='text' name='REMOTE_SUBNET' value='$cgiparams{'REMOTE_SUBNET'}' /></td></tr>
+                   <td width='25%'>&nbsp;</td></tr>    
+       <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'Act as'}</td>
+               <td><select name='SIDE'>
+                               <option value='server' $selected{'SIDE'}{'server'}>$Lang::tr{'openvpn server'}</option>
+                               <option value='client' $selected{'SIDE'}{'client'}>$Lang::tr{'openvpn client'}</option>
+                       </select>
+               </td>
 
-               <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'ovpn subnet'}</td>
-                   <td><input type='TEXT' name='OVPN_SUBNET' value='$cgiparams{'OVPN_SUBNET'}' /></td></tr>
+               <td class='boldbase'>$Lang::tr{'remote host/ip'}:</td>
+               <td><input type='TEXT' name='REMOTE' value='$cgiparams{'REMOTE'}' /></td>
+       </tr>
 
-                   
-               <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'protocol'}</td>
-                       <td><select name='PROTOCOL'><option value='udp' $selected{'PROTOCOL'}{'udp'}>UDP</option>
-                                       <option value='tcp' $selected{'PROTOCOL'}{'tcp'}>TCP</option></select></td>
+       <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'local subnet'}</td>
+               <td><input type='TEXT' name='LOCAL_SUBNET' value='$cgiparams{'LOCAL_SUBNET'}' /></td>
 
-                       <td class='boldbase'>$Lang::tr{'destination port'}:</td>
-                       <td><input type='TEXT' name='DEST_PORT' value='$cgiparams{'DEST_PORT'}' size='5' /></td>
-               </tr>
+               <td class='boldbase' nowrap='nowrap'>$Lang::tr{'remote subnet'}</td>
+               <td><input type='text' name='REMOTE_SUBNET' value='$cgiparams{'REMOTE_SUBNET'}' /></td>
+       </tr>
 
-               <tr><td class='boldbase'>$Lang::tr{'cipher'}</td>
-                       <td><select name='DCIPHER'>
-                                       <option value='CAMELLIA-256-CBC'        $selected{'DCIPHER'}{'CAMELLIA-256-CBC'}>CAMELLIA-CBC (256 $Lang::tr{'bit'})</option>
-                                       <option value='CAMELLIA-192-CBC'        $selected{'DCIPHER'}{'CAMELLIA-192-CBC'}>CAMELLIA-CBC (196 $Lang::tr{'bit'})</option>
-                                       <option value='CAMELLIA-128-CBC'        $selected{'DCIPHER'}{'CAMELLIA-128-CBC'}>CAMELLIA-CBC (128 $Lang::tr{'bit'})</option>
-                                       <option value='AES-256-CBC'             $selected{'DCIPHER'}{'AES-256-CBC'}>AES-CBC (256 $Lang::tr{'bit'})</option>
-                                       <option value='AES-192-CBC'             $selected{'DCIPHER'}{'AES-192-CBC'}>AES-CBC (192 $Lang::tr{'bit'})</option>
-                                       <option value='AES-128-CBC'             $selected{'DCIPHER'}{'AES-128-CBC'}>AES-CBC (128 $Lang::tr{'bit'})</option>
-                                       <option value='DES-EDE3-CBC'            $selected{'DCIPHER'}{'DES-EDE3-CBC'}>DES-EDE3-CBC (192 $Lang::tr{'bit'})</option>
-                                       <option value='DESX-CBC'                $selected{'DCIPHER'}{'DESX-CBC'}>DESX-CBC (192 $Lang::tr{'bit'})</option>
-                                       <option value='SEED-CBC'                $selected{'DCIPHER'}{'SEED-CBC'}>SEED-CBC (128 $Lang::tr{'bit'})</option>
-                                       <option value='DES-EDE-CBC'             $selected{'DCIPHER'}{'DES-EDE-CBC'}>DES-EDE-CBC (128 $Lang::tr{'bit'})</option>
-                                       <option value='BF-CBC'                  $selected{'DCIPHER'}{'BF-CBC'}>BF-CBC (128 $Lang::tr{'bit'})</option>
-                                       <option value='CAST5-CBC'               $selected{'DCIPHER'}{'CAST5-CBC'}>CAST5-CBC (128 $Lang::tr{'bit'})</option>
-                                       <option value='RC2-CBC'                 $selected{'DCIPHER'}{'RC2-CBC'}>RC2-CBC (128 $Lang::tr{'bit'})</option>
-                                       <option value='DES-CBC'                 $selected{'DCIPHER'}{'DES-CBC'}>DES-CBC (64 $Lang::tr{'bit'} not recommended)</option>
-                                       <option value='RC2-64-CBC'              $selected{'DCIPHER'}{'RC2-64-CBC'}>RC2-CBC (64 $Lang::tr{'bit'} not recommended)</option>
-                                       <option value='RC2-40-CBC'              $selected{'DCIPHER'}{'RC2-40-CBC'}>RC2-CBC (40 $Lang::tr{'bit'} not recommended)</option>
-                               </select>
-                       </td>
-
-                       <td class='boldbase'>$Lang::tr{'ovpn ha'}:</td>
-                       <td><select name='DAUTH'>
-                                       <option value='whirlpool'               $selected{'DAUTH'}{'whirlpool'}>Whirlpool (512 $Lang::tr{'bit'})</option>
-                                       <option value='SHA512'                  $selected{'DAUTH'}{'SHA512'}>SHA2 (512 $Lang::tr{'bit'})</option>
-                                       <option value='SHA384'                  $selected{'DAUTH'}{'SHA384'}>SHA2 (384 $Lang::tr{'bit'})</option>
-                                       <option value='SHA256'                  $selected{'DAUTH'}{'SHA256'}>SHA2 (256 $Lang::tr{'bit'})</option>
-                                       <option value='SHA1'                    $selected{'DAUTH'}{'SHA1'}>SHA1 (160 $Lang::tr{'bit'} Default)</option>
-                               </select>
-                       </td>
-               </tr>
+       <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'ovpn subnet'}</td>
+               <td><input type='TEXT' name='OVPN_SUBNET' value='$cgiparams{'OVPN_SUBNET'}' /></td>
 
-               <tr>    <td class='boldbase' nowrap='nowrap'>$Lang::tr{'ovpn engines'} &nbsp;<img src='/blob.gif'</td>
-                       <td><select name='ENGINES'>
-                                       <option value='cryptodev'               $selected{'ENGINES'}{'cryptodev'}>Cryptodev</option>
-                                       <option value='dynamic'                 $selected{'ENGINES'}{'dynamic'}>Dynamic</option>
-                                       <option value='aesni'                   $selected{'ENGINES'}{'aesni'}>AES-NI</option>
-                                       <option value='padlock'                 $selected{'ENGINES'}{'padlock'}>Padlock</option>
-                                       <option value='disabled'                $selected{'ENGINES'}{'disabled'}>$Lang::tr{'disabled'} (Default)</option>
-                               </select>
-                       </td>
-               </tr>
+               <td class='boldbase' nowrap='nowrap'>$Lang::tr{'protocol'}</td>
+               <td><select name='PROTOCOL'>
+                       <option value='udp' $selected{'PROTOCOL'}{'udp'}>UDP</option>
+                       <option value='tcp' $selected{'PROTOCOL'}{'tcp'}>TCP</option></select></td>
+       </tr>
+       
+       <tr>
+               <td class='boldbase'>$Lang::tr{'destination port'}:</td>
+               <td><input type='TEXT' name='DEST_PORT' value='$cgiparams{'DEST_PORT'}' size='5' /></td>
 
-               <tr><td colspan=2><hr /></td></tr><tr>
+               <td class='boldbase' nowrap='nowrap'>Management Port ($Lang::tr{'openvpn default'}: <span class="base">$Lang::tr{'destination port'}): &nbsp;<img src='/blob.gif' /></td>
+               <td> <input type='TEXT' name='OVPN_MGMT' VALUE='$cgiparams{'OVPN_MGMT'}'size='5' /></td>
+       </tr>
 
-                       <tr><td class='boldbase' nowrap='nowrap'>Management Port ($Lang::tr{'openvpn default'}: <span class="base">$Lang::tr{'destination port'}): &nbsp;<img src='/blob.gif' /></td>
-                       <td> <input type='TEXT' name='OVPN_MGMT' VALUE='$cgiparams{'OVPN_MGMT'}'size='5' /></td>
-               </tr>
+       <tr><td colspan=4><hr /></td></tr><tr>
+       
+       <tr>
+               <td class'base'><b>$Lang::tr{'MTU settings'}</b></td>
+       </tr>
 
-               <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'MTU'}&nbsp;<img src='/blob.gif' /></td>
-                       <td> <input type='TEXT' name='MTU' VALUE='$cgiparams{'MTU'}'size='5' /></td>
-                       <td colspan='2'>$Lang::tr{'openvpn default'}: udp/tcp <span class="base">1500/1400</span></td>
-               </tr>
+        <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'MTU'}&nbsp;<img src='/blob.gif' /></td>
+               <td><input type='TEXT' name='MTU' VALUE='$cgiparams{'MTU'}'size='5' /></td>
+               <td colspan='2'>$Lang::tr{'openvpn default'}: udp/tcp <span class="base">1500/1400</span></td>
+       </tr>
 
-               <tr><td class='boldbase' nowrap='nowrap'>fragment &nbsp;<img src='/blob.gif' /></td>
-                       <td><input type='TEXT' name='FRAGMENT' VALUE='$cgiparams{'FRAGMENT'}'size='5' /></td>
-                       <td>$Lang::tr{'openvpn default'}: <span class="base">1300</span></td>
-               </tr>
+       <tr><td class='boldbase' nowrap='nowrap'>fragment &nbsp;<img src='/blob.gif' /></td>
+               <td><input type='TEXT' name='FRAGMENT' VALUE='$cgiparams{'FRAGMENT'}'size='5' /></td>
+               <td>$Lang::tr{'openvpn default'}: <span class="base">1300</span></td>
+       </tr>
 
-               <tr><td class='boldbase' nowrap='nowrap'>mssfix &nbsp;<img src='/blob.gif' /></td>
-                       <td><input type='checkbox' name='MSSFIX' $checked{'MSSFIX'}{'on'} /></td>
-                       <td>$Lang::tr{'openvpn default'}: <span class="base">on</span></td>
-               </tr>
+       <tr><td class='boldbase' nowrap='nowrap'>mssfix &nbsp;<img src='/blob.gif' /></td>
+               <td><input type='checkbox' name='MSSFIX' $checked{'MSSFIX'}{'on'} /></td>
+               <td>$Lang::tr{'openvpn default'}: <span class="base">on</span></td>
+       </tr>
 
-               <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'comp-lzo'} &nbsp;<img src='/blob.gif'</td>
-                       <td><input type='checkbox' name='COMPLZO' $checked{'COMPLZO'}{'on'} /></td>
-               </tr>
+        <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'comp-lzo'} &nbsp;<img src='/blob.gif'</td>
+               <td><input type='checkbox' name='COMPLZO' $checked{'COMPLZO'}{'on'} /></td>
+       </tr>
 
        <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'ovpn mtu-disc'}</td>
                <td colspan='3'>
@@ -4610,6 +4566,40 @@ if ($cgiparams{'TYPE'} eq 'net') {
                </td>
        </tr>
 
+<tr><td colspan=4><hr /></td></tr><tr>
+       <tr>
+               <td class'base'><b>$Lang::tr{'ovpn crypt options'}:</b></td>
+       </tr>
+
+       <tr><td class='boldbase'>$Lang::tr{'cipher'}</td>
+               <td><select name='DCIPHER'>
+                               <option value='CAMELLIA-256-CBC'        $selected{'DCIPHER'}{'CAMELLIA-256-CBC'}>CAMELLIA-CBC (256 $Lang::tr{'bit'})</option>
+                               <option value='CAMELLIA-192-CBC'        $selected{'DCIPHER'}{'CAMELLIA-192-CBC'}>CAMELLIA-CBC (192 $Lang::tr{'bit'})</option>
+                               <option value='CAMELLIA-128-CBC'        $selected{'DCIPHER'}{'CAMELLIA-128-CBC'}>CAMELLIA-CBC (128 $Lang::tr{'bit'})</option>
+                               <option value='AES-256-CBC'             $selected{'DCIPHER'}{'AES-256-CBC'}>AES-CBC (256 $Lang::tr{'bit'})</option>
+                               <option value='AES-192-CBC'             $selected{'DCIPHER'}{'AES-192-CBC'}>AES-CBC (192 $Lang::tr{'bit'})</option>
+                               <option value='AES-128-CBC'             $selected{'DCIPHER'}{'AES-128-CBC'}>AES-CBC (128 $Lang::tr{'bit'})</option>
+                               <option value='DES-EDE3-CBC'            $selected{'DCIPHER'}{'DES-EDE3-CBC'}>DES-EDE3-CBC (192 $Lang::tr{'bit'})</option>
+                               <option value='DESX-CBC'                $selected{'DCIPHER'}{'DESX-CBC'}>DESX-CBC (192 $Lang::tr{'bit'})</option>
+                               <option value='SEED-CBC'                $selected{'DCIPHER'}{'SEED-CBC'}>SEED-CBC (128 $Lang::tr{'bit'})</option>
+                               <option value='DES-EDE-CBC'             $selected{'DCIPHER'}{'DES-EDE-CBC'}>DES-EDE-CBC (128 $Lang::tr{'bit'})</option>
+                               <option value='BF-CBC'                  $selected{'DCIPHER'}{'BF-CBC'}>BF-CBC (128 $Lang::tr{'bit'})</option>
+                               <option value='CAST5-CBC'               $selected{'DCIPHER'}{'CAST5-CBC'}>CAST5-CBC (128 $Lang::tr{'bit'})</option>
+                       </select>
+               </td>
+
+               <td class='boldbase'>$Lang::tr{'ovpn ha'}:</td>
+               <td><select name='DAUTH'>
+                               <option value='whirlpool'               $selected{'DAUTH'}{'whirlpool'}>Whirlpool (512 $Lang::tr{'bit'})</option>
+                               <option value='SHA512'                  $selected{'DAUTH'}{'SHA512'}>SHA2 (512 $Lang::tr{'bit'})</option>
+                               <option value='SHA384'                  $selected{'DAUTH'}{'SHA384'}>SHA2 (384 $Lang::tr{'bit'})</option>
+                               <option value='SHA256'                  $selected{'DAUTH'}{'SHA256'}>SHA2 (256 $Lang::tr{'bit'})</option>
+                               <option value='SHA1'                    $selected{'DAUTH'}{'SHA1'}>SHA1 (160 $Lang::tr{'bit'} Default)</option>
+                       </select>
+               </td>
+       </tr>
+       <tr><td colspan=4><hr /></td></tr><tr>
+
 END
 ;
        }
@@ -4739,7 +4729,7 @@ if ($cgiparams{'TYPE'} eq 'host') {
    <tr><td>&nbsp;</td>
                <td class='base'>$Lang::tr{'pkcs12 file password'}:</td>
                <td class='base' nowrap='nowrap'><input type='password' name='CERT_PASS1' value='$cgiparams{'CERT_PASS1'}' size='32' $cakeydisabled /></td></tr>
-           <tr><td>&nbsp;</td><td class='base'>$Lang::tr{'pkcs12 file password'}:<br>($Lang::tr{'confirmation'})</td>
+           <tr><td>&nbsp;</td><td class='base'>$Lang::tr{'pkcs12 file password'}:<BR>($Lang::tr{'confirmation'})</td>
                <td class='base' nowrap='nowrap'><input type='password' name='CERT_PASS2' value='$cgiparams{'CERT_PASS2'}' size='32' $cakeydisabled /></td></tr>
      <tr><td colspan='3'>&nbsp;</td></tr>
      <tr><td colspan='3'><hr /></td></tr>
@@ -4923,19 +4913,25 @@ END
     
 #default setzen
     if ($cgiparams{'DCIPHER'} eq '') {
-       $cgiparams{'DCIPHER'} =  'AES-256-CBC';
+               $cgiparams{'DCIPHER'} =  'AES-256-CBC';
     }
     if ($cgiparams{'DDEST_PORT'} eq '') {
-       $cgiparams{'DDEST_PORT'} =  '1194';     
+               $cgiparams{'DDEST_PORT'} =  '1194';
     }
     if ($cgiparams{'DMTU'} eq '') {
-       $cgiparams{'DMTU'} =  '1400';     
+               $cgiparams{'DMTU'} =  '1400';
+    }
+    if ($cgiparams{'MSSFIX'} eq '') {
+               $cgiparams{'MSSFIX'} = 'off';
+    }
+       if ($cgiparams{'DAUTH'} eq '') {
+               $cgiparams{'DAUTH'} = 'SHA1';
     }
     if ($cgiparams{'ENGINES'} eq '') {
        $cgiparams{'ENGINES'} = 'disabled';
     }
     if ($cgiparams{'DOVPN_SUBNET'} eq '') {
-       $cgiparams{'DOVPN_SUBNET'} = '10.' . int(rand(256)) . '.' . int(rand(256)) . '.0/255.255.255.0';
+               $cgiparams{'DOVPN_SUBNET'} = '10.' . int(rand(256)) . '.' . int(rand(256)) . '.0/255.255.255.0';
     }
     $checked{'ENABLED'}{'off'} = '';
     $checked{'ENABLED'}{'on'} = '';
@@ -4953,7 +4949,7 @@ END
     $selected{'DPROTOCOL'}{'udp'} = '';
     $selected{'DPROTOCOL'}{'tcp'} = '';
     $selected{'DPROTOCOL'}{$cgiparams{'DPROTOCOL'}} = 'SELECTED';
-    
+
     $selected{'DCIPHER'}{'CAMELLIA-256-CBC'} = '';
     $selected{'DCIPHER'}{'CAMELLIA-192-CBC'} = '';
     $selected{'DCIPHER'}{'CAMELLIA-128-CBC'} = '';
@@ -4966,10 +4962,7 @@ END
     $selected{'DCIPHER'}{'DES-EDE-CBC'} = '';
     $selected{'DCIPHER'}{'CAST5-CBC'} = '';
     $selected{'DCIPHER'}{'BF-CBC'} = '';
-    $selected{'DCIPHER'}{'RC2-CBC'} = '';
     $selected{'DCIPHER'}{'DES-CBC'} = '';
-    $selected{'DCIPHER'}{'RC2-64-CBC'} = '';
-    $selected{'DCIPHER'}{'RC2-40-CBC'} = '';
     $selected{'DCIPHER'}{$cgiparams{'DCIPHER'}} = 'SELECTED';
 
     $selected{'DAUTH'}{'whirlpool'} = '';
@@ -4979,16 +4972,10 @@ END
     $selected{'DAUTH'}{'SHA1'} = '';
     $selected{'DAUTH'}{$cgiparams{'DAUTH'}} = 'SELECTED';
 
-    $selected{'ENGINES'}{'cryptodev'} = '';
-    $selected{'ENGINES'}{'dynamic'} = '';
-    $selected{'ENGINES'}{'aesni'} = '';
-    $selected{'ENGINES'}{'padlock'} = '';
-    $selected{'ENGINES'}{'disabled'} = '';
-    $selected{'ENGINES'}{$cgiparams{'ENGINES'}} = 'SELECTED';
-
     $checked{'DCOMPLZO'}{'off'} = '';
     $checked{'DCOMPLZO'}{'on'} = '';
     $checked{'DCOMPLZO'}{$cgiparams{'DCOMPLZO'}} = 'CHECKED';
+
 # m.a.d
     $checked{'MSSFIX'}{'off'} = '';
     $checked{'MSSFIX'}{'on'} = '';
@@ -5046,7 +5033,7 @@ END
        print "<tr><td class='boldbase'>$Lang::tr{'ovpn on orange'}</td>";
        print "<td><input type='checkbox' name='ENABLED_ORANGE' $checked{'ENABLED_ORANGE'}{'on'} /></td>";
     }  
-    print <<END        
+    print <<END;
     <tr><td class='base' nowrap='nowrap' colspan='2'>$Lang::tr{'local vpn hostname/ip'}:<br /><input type='text' name='VPN_IP' value='$cgiparams{'VPN_IP'}' size='30' /></td>
        <td class='boldbase' nowrap='nowrap' colspan='2'>$Lang::tr{'ovpn subnet'}<br /><input type='TEXT' name='DOVPN_SUBNET' value='$cgiparams{'DOVPN_SUBNET'}' size='30' /></td></tr>
     <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'ovpn device'}</td>
@@ -5064,7 +5051,7 @@ END
                <td class='boldbase' nowrap='nowrap'>$Lang::tr{'cipher'}</td>
                <td><select name='DCIPHER'>
                                <option value='CAMELLIA-256-CBC' $selected{'DCIPHER'}{'CAMELLIA-256-CBC'}>CAMELLIA-CBC (256 $Lang::tr{'bit'})</option>
-                               <option value='CAMELLIA-192-CBC' $selected{'DCIPHER'}{'CAMELLIA-192-CBC'}>CAMELLIA-CBC (196 $Lang::tr{'bit'})</option>
+                               <option value='CAMELLIA-192-CBC' $selected{'DCIPHER'}{'CAMELLIA-192-CBC'}>CAMELLIA-CBC (192 $Lang::tr{'bit'})</option>
                                <option value='CAMELLIA-128-CBC' $selected{'DCIPHER'}{'CAMELLIA-128-CBC'}>CAMELLIA-CBC (128 $Lang::tr{'bit'})</option>
                                <option value='AES-256-CBC' $selected{'DCIPHER'}{'AES-256-CBC'}>AES-CBC (256 $Lang::tr{'bit'})</option>
                                <option value='AES-192-CBC' $selected{'DCIPHER'}{'AES-192-CBC'}>AES-CBC (192 $Lang::tr{'bit'})</option>
@@ -5075,16 +5062,11 @@ END
                                <option value='DES-EDE-CBC' $selected{'DCIPHER'}{'DES-EDE-CBC'}>DES-EDE-CBC (128 $Lang::tr{'bit'})</option>
                                <option value='BF-CBC' $selected{'DCIPHER'}{'BF-CBC'}>BF-CBC (128 $Lang::tr{'bit'})</option>
                                <option value='CAST5-CBC' $selected{'DCIPHER'}{'CAST5-CBC'}>CAST5-CBC (128 $Lang::tr{'bit'})</option>
-                               <option value='RC2-CBC' $selected{'DCIPHER'}{'RC2-CBC'}>RC2-CBC (128 $Lang::tr{'bit'})</option>
-                               <option value='DES-CBC' $selected{'DCIPHER'}{'DES-CBC'}>DES-CBC (64 $Lang::tr{'bit'} not recommended)</option>
-                               <option value='RC2-64-CBC' $selected{'DCIPHER'}{'RC2-64-CBC'}>RC2-CBC (64 $Lang::tr{'bit'} not recommended)</option>
-                               <option value='RC2-40-CBC' $selected{'DCIPHER'}{'RC2-40-CBC'}>RC2-CBC (40 $Lang::tr{'bit'} not recommended)</option>
                        </select>
                </td>
     <tr><td class='boldbase' nowrap='nowrap'>$Lang::tr{'comp-lzo'}</td>
         <td><input type='checkbox' name='DCOMPLZO' $checked{'DCOMPLZO'}{'on'} /></td>
        </tr>
-
     <tr><td colspan='4'><br><br></td></tr>
 END
 ;                                 
@@ -5114,7 +5096,6 @@ END
     &Header::closebox();
 
     if ( -f "${General::swroot}/ovpn/ca/cacert.pem" ) {
-
 ###
 # m.a.d net2net
 #<td width='25%' class='boldbase' align='center'><b>$Lang::tr{'remark'}</b><br /><img src='/images/null.gif' width='125' height='1' border='0' alt='L2089' /></td>
@@ -5196,7 +5177,7 @@ END
 #EXITING       -- A graceful exit is in progress.
 ####
 
-               if ($tustate[1] eq 'CONNECTED') {
+               if (($tustate[1] eq 'CONNECTED') || ($tustate[1] eq 'WAIT')) {
                        $col1="bgcolor='${Header::colourgreen}'";
                        $active = "<b><font color='#FFFFFF'>$Lang::tr{'capsopen'}</font></b>";
                }else {
@@ -5475,22 +5456,32 @@ END
                <td nowrap='nowrap' align='right'><input type='submit' name='ACTION' value='$Lang::tr{'upload ca certificate'}' /></td>
        </tr>
 
+       <tr align='right'>
+               <td colspan='4' align='right' width='80%'><input type='submit' name='ACTION' value='$Lang::tr{'show crl'}' /></td>
+       </tr>
+
+       <tr><td colspan=4><hr /></td></tr><tr>
+       <tr>
+               <td class'base'><b>$Lang::tr{'ovpn dh parameters'}:</b></td>
+       </tr>
+
        <tr>
                <td class='base' nowrap='nowrap'>$Lang::tr{'ovpn dh upload'}:</td>
                <td nowrap='nowrap'><size='15' align='left'/></td>
                <td nowrap='nowrap'><input type='file' name='FH' size='25' />
                <td colspan='4' align='right'><input type='submit' name='ACTION' value='$Lang::tr{'upload dh key'}' /></td>
        </tr>
-       <tr><td colspan='4'><br></td></tr>
        <tr>
+               <td class='base' nowrap='nowrap'>$Lang::tr{'ovpn dh new key'}:</td>
+               <td nowrap='nowrap'><size='15' align='left'/></td>
                <td nowrap='nowrap'><input type='submit' name='ACTION' value='$Lang::tr{'generate dh key'}' /></td>
-               <td colspan='4' align='right'><input type='submit' name='ACTION' value='$Lang::tr{'show dh'}' /></td>
        </tr>
-
-       <tr align='right'>
-               <td colspan='4' align='right' width='80%'><input type='submit' name='ACTION' value='$Lang::tr{'show crl'}' /></td>
+       <tr>
+               <td colspan='4' align='right'><input type='submit' name='ACTION' value='$Lang::tr{'show dh'}' /></td>
        </tr>
        </table>
+       
+       <tr><td colspan=4><hr /></td></tr><tr>
 END
        ;