3
0

mise à jour du démon et du certificat

This commit is contained in:
karchnu 2015-12-22 22:33:23 +01:00
parent bbc4801c3f
commit 2a7a016782
3 changed files with 59 additions and 66 deletions

View File

@ -1,4 +1,4 @@
# mise à jour auto # mise à jour automatique (façon DynDNS)
Pour mettre à jour automatiquement une adresse IP d'un nom de domaine, il faut Pour mettre à jour automatiquement une adresse IP d'un nom de domaine, il faut
changer les quelques valeurs du fichier daemon.pl (en haut) et avoir le changer les quelques valeurs du fichier daemon.pl (en haut) et avoir le

View File

@ -1,31 +1,31 @@
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIFUDCCAzgCCQDV/QJQr9sX7DANBgkqhkiG9w0BAQsFADBqMQswCQYDVQQGEwJG MIIFUDCCAzgCCQCq5y4848m2JzANBgkqhkiG9w0BAQsFADBqMQswCQYDVQQGEwJG
UjEPMA0GA1UECAwGQWxzYWNlMRMwEQYDVQQHDApTdHJhc2JvdXJnMRIwEAYDVQQD UjEPMA0GA1UECAwGQWxzYWNlMRMwEQYDVQQHDApTdHJhc2JvdXJnMRIwEAYDVQQD
DAluZXRsaWIucmUxITAfBgkqhkiG9w0BCQEWEmthcmNobnVAa2FyY2hudS5mcjAe DAluZXRsaWIucmUxITAfBgkqhkiG9w0BCQEWEmthcmNobnVAa2FyY2hudS5mcjAe
Fw0xNDA4MjMwODAwNThaFw0xNTA4MjMwODAwNThaMGoxCzAJBgNVBAYTAkZSMQ8w Fw0xNTEyMjIyMTA5MTVaFw0xNjEyMjEyMTA5MTVaMGoxCzAJBgNVBAYTAkZSMQ8w
DQYDVQQIDAZBbHNhY2UxEzARBgNVBAcMClN0cmFzYm91cmcxEjAQBgNVBAMMCW5l DQYDVQQIDAZBbHNhY2UxEzARBgNVBAcMClN0cmFzYm91cmcxEjAQBgNVBAMMCW5l
dGxpYi5yZTEhMB8GCSqGSIb3DQEJARYSa2FyY2hudUBrYXJjaG51LmZyMIICIjAN dGxpYi5yZTEhMB8GCSqGSIb3DQEJARYSa2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nhEfj1wrTb3jdY9NSBBsc2o4bgb8nYQfqsRv8y 3auH+JDRWUK4LAFcDskynntNxEF3VAxsqATihDxx2GC/4Nw1uNjJZR79s+Bq/NDc
F0yqzWbBiYKPhITf2n8qdUV3k5FE+uVLlqRERQOa07+kS5kUrpPHurhhgIXN2c2p 50j1UZistkdlv+C9vi/B1p2eIhiPnxEcYyIwlJ/hmKVwEDAhmMfCTnSRntOV5Sed
Xutz+EmDyWyLyDCXAk4kKGldiqUpIozs4faYJOxtlZmNKXmokmalSl9eN/S8tIXQ zw6w7LapDvERnT+QQ/2nIRzhc7dSUF0a5i/ATMHx3NCRvcpDbhnk0y5t8+1pZjUv
JQ/dJnvYW9L0hvHWxF03LJ5Pee88nZfIRyN0R6olLcI3oSWCOJAfFeqklnJj5YHs rAcfCH+Mdeg+GhJ3+xCwWLaDhAoAUfPDXrl9C/Ie4qqCwL3uQZjh332ZUY6xut0A
G43BeSW4DGPKCRz6x3i7Y2S5mbfqHFzg1OloU2ybbvCSJhuxyEiSxPkWv5Tl867x AlZCINMymDmg3LTNgoJdieFpgkYfmDrLPWIKMIWU3qNqhxfN5QL715NBOYSUEgZF
ltju9/n8caTlMRAxskGhYnlmg7xsMrr474YAWxelo1OAEbwA+8mWKlbOFa40BHMt kxCQT0AB0KRyDWWaDkH3FsUZFsvygY2OTI8QfraTVFlh3SSRkn/To7l0CVFnM4B9
Ih5Vwu3gN7dmX293gXRYTSnYBgs= qmWLMe+4QMmwGR162WYu+Xmppl8=
-----END CERTIFICATE----- -----END CERTIFICATE-----

View File

@ -3,15 +3,29 @@ use strict;
use warnings; use warnings;
use v5.14; use v5.14;
our $ndd = "netlib.re"; # the website sending your current IP address
our $domain = "montest.netlib.re"; our $checkip = "http://t.karchnu.fr/ip.php";
our $name = "www";
our $ttl = "3600"; # Domain name of the service provider (like netlib.re)
our $login = "test"; our $nddservice = "netlib.re";
our $pass = "test";
# Your domain
our $domain = "test.netlib.re";
# Login and password to connect to the website
our $login = "idtest";
our $pass = "mdptest";
# Your entry to change
our $name = 'www';
our $type = 'A'; # could be AAAA
# The CA certificate, to authenticate the website (should be provided)
# Check your service provider for updates
our $cacert = "ca.cert";
sub get_ip { sub get_ip {
my @tmp_ip = split "\n", `wget -nv -O - http://t.karchnu.fr/ip.php`; my @tmp_ip = split "\n", `wget -nv -O - $checkip`;
my $ip; my $ip;
for(@tmp_ip) { for(@tmp_ip) {
@ -25,35 +39,14 @@ sub get_ip {
sub update { sub update {
my $ip = get_ip; my $ip = get_ip;
my $type;
if($ip =~ /:/) { say "UPDATE :: domain $name.$domain => IP $ip, type $type";
$type = "AAAA";
}
else {
$type = "A";
}
my $todig;
if($name =~ '@') {
$todig = $domain;
}
else {
$todig = "$name.$domain";
}
my $oldhost = `dig +short $todig`; my $cmd = "wget -O - ";
chomp $oldhost; $cmd .=
"https://$nddservice/domain/cliup/$login/$pass/$domain/$name/$type/$ip ";
say "domain $domain"; $cmd .= "--ca-certificate=$cacert";
say "name $name"; say `$cmd`;
say "type $type";
say "oldhost $oldhost";
say "ttl $ttl";
say "ip $ip";
#say "wget -O - https://$ndd/domain/cli/$login/$pass/$domain/$name/$type/$oldhost/$ttl/$ip --ca-certificate=ca.cert";
say `wget -O - https://$ndd/domain/cli/$login/$pass/$domain/$name/$type/$oldhost/$ttl/$ip --ca-certificate=ca.cert`;
} }
update; update;