aboutsummaryrefslogtreecommitdiffstats
path: root/config/tinc
diff options
context:
space:
mode:
authorbmeeks8 <bmeeks8@bellsouth.net>2014-01-07 20:22:00 -0500
committerbmeeks8 <bmeeks8@bellsouth.net>2014-01-07 20:22:00 -0500
commita8b5c4c392069ab4c06c19d53d4dccf8c423a9ef (patch)
tree7fdb7130a804f0191c22bababa62c44e2b88fb50 /config/tinc
parent7234111aaac38d620a4e5356d212fa51e2591d8b (diff)
parentb1962cf93379b0f9f3dfbfa69cd67f19af7c1539 (diff)
downloadpfsense-packages-a8b5c4c392069ab4c06c19d53d4dccf8c423a9ef.tar.gz
pfsense-packages-a8b5c4c392069ab4c06c19d53d4dccf8c423a9ef.tar.bz2
pfsense-packages-a8b5c4c392069ab4c06c19d53d4dccf8c423a9ef.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'config/tinc')
-rw-r--r--config/tinc/tinc.inc17
-rw-r--r--config/tinc/tinc_config.xml6
2 files changed, 23 insertions, 0 deletions
diff --git a/config/tinc/tinc.inc b/config/tinc/tinc.inc
index cdfb23e5..944cb846 100644
--- a/config/tinc/tinc.inc
+++ b/config/tinc/tinc.inc
@@ -42,6 +42,22 @@ function tinc_save() {
}
fwrite($fout, base64_decode($tincconf['extra'])."\n");
fclose($fout);
+
+ // Check if we need to generate a new RSA key pair.
+ if ($tincconf['gen_rsa'])
+ {
+ safe_mkdir("/usr/local/etc/tinc/tmp");
+ exec("/usr/local/sbin/tincd -c /usr/local/etc/tinc/tmp -K");
+ $tincconf['cert_pub'] = base64_encode(file_get_contents('/usr/local/etc/tinc/tmp/rsa_key.pub'));
+ $tincconf['cert_key'] = base64_encode(file_get_contents('/usr/local/etc/tinc/tmp/rsa_key.priv'));
+ $tincconf['gen_rsa'] = false;
+ $config['installedpackages']['tinc']['config'][0]['cert_pub'] = $tincconf['cert_pub'];
+ $config['installedpackages']['tinc']['config'][0]['cert_key'] = $tincconf['cert_key'];
+ $config['installedpackages']['tinc']['config'][0]['gen_rsa'] = $tincconf['gen_rsa'];
+ rmdir_recursive("/usr/local/etc/tinc/tmp");
+ write_config();
+ }
+
$_output = "Subnet=" . $tincconf['localsubnet'] . "\n";
$_output .= base64_decode($tincconf['host_extra']) . "\n";
$_output .= base64_decode($tincconf['cert_pub']) . "\n";
@@ -86,6 +102,7 @@ function tinc_save() {
}
system("/usr/local/etc/rc.d/tinc.sh restart 2>/dev/null");
rmdir_recursive("/usr/local/etc/tinc.old");
+
conf_mount_ro();
config_unlock();
}
diff --git a/config/tinc/tinc_config.xml b/config/tinc/tinc_config.xml
index 3878450f..d6ee9c26 100644
--- a/config/tinc/tinc_config.xml
+++ b/config/tinc/tinc_config.xml
@@ -122,6 +122,12 @@
<cols>65</cols>
</field>
<field>
+ <fielddescr>Generate RSA key pair</fielddescr>
+ <fieldname>gen_rsa</fieldname>
+ <description>This will generate a new RSA key pair in the fields above.</description>
+ <type>checkbox</type>
+ </field>
+ <field>
<fielddescr>Extra Tinc Parameters</fielddescr>
<fieldname>extra</fieldname>
<description>Anything entered here will be added at the end of the tinc.conf configuration file. &lt;br&gt;</description>