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
changer les quelques valeurs du fichier daemon.pl (en haut) et avoir le

View File

@ -1,31 +1,31 @@
-----BEGIN CERTIFICATE-----
MIIFUDCCAzgCCQDV/QJQr9sX7DANBgkqhkiG9w0BAQsFADBqMQswCQYDVQQGEwJG
UjEPMA0GA1UECAwGQWxzYWNlMRMwEQYDVQQHDApTdHJhc2JvdXJnMRIwEAYDVQQD
DAluZXRsaWIucmUxITAfBgkqhkiG9w0BCQEWEmthcmNobnVAa2FyY2hudS5mcjAe
Fw0xNDA4MjMwODAwNThaFw0xNTA4MjMwODAwNThaMGoxCzAJBgNVBAYTAkZSMQ8w
DQYDVQQIDAZBbHNhY2UxEzARBgNVBAcMClN0cmFzYm91cmcxEjAQBgNVBAMMCW5l
dGxpYi5yZTEhMB8GCSqGSIb3DQEJARYSa2FyY2hudUBrYXJjaG51LmZyMIICIjAN
BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxaqx8ToKV4lxqOJa+h7WA9qh7ygk
3JGOx6EEquL29YUfZXvKHjA3fNUIAXzlUJZXferLO/w62t4M9Lha0beOuM3gQvXz
RzeGAgzeEAfDN892+GIYwf7e4a6VQFU99Bb6/cetnqFSw9PiFIC1XpG/lCSR4INd
8msGuW6YIJ30AYE2PWNhn8C44szpe4xzQrv5omJsRC4+DXe9yLAdurbvUXzEijE3
3rii+vlj52awfsCwxGDh8oblm/ir0ISBqTpq6V/xsCD8S4L9c80HeqGzmcF1LpEl
dpcSDKLCXLszwKJz/aNiUxPq4m7IWe0av87hUGunzDT9+NUwWcsqHBdAuACQ6xK+
j3ZtzoiZtPDKLyfdKc4kgx1heiWLn6KCSqgHmfYLQiT7o0kYpOMM7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354iZpwlHJlUut6sNEJBqUt/i/
tcHTsQI64xhv3z0CAwEAATANBgkqhkiG9w0BAQsFAAOCAgEAQhKm5NGO6DvKC2Wn
UTSHdpVvTlai6FgzTkAsZTW3pLW7vpYk3L1oGr0T5C+v8tLVwBwTZXtaaWqkr205
J8i02Mt2l7gcKuCyMfWhtH03Ue6dp/s4kHh68jp2FYbZ0R7U9W9XoDL+CW1Xm9hA
ZQS4C8Jyuiv4WrgTNn8MWQdlEo9Ln+V3sHHKBoetVRgSv/HPRxjAOxvEF1xu408p
HVjL3bZkZLnDPd/poYa4IN6lAEYhmVBbO7uFzqNPfDgMHm/nJotXwFkRyr1Msl2f
3auH+JDRWUK4LAFcDskynntNxEF3VAxsqATihDxx2GC/4Nw1uNjJZR79s+Bq/NDc
50j1UZistkdlv+C9vi/B1p2eIhiPnxEcYyIwlJ/hmKVwEDAhmMfCTnSRntOV5Sed
zw6w7LapDvERnT+QQ/2nIRzhc7dSUF0a5i/ATMHx3NCRvcpDbhnk0y5t8+1pZjUv
rAcfCH+Mdeg+GhJ3+xCwWLaDhAoAUfPDXrl9C/Ie4qqCwL3uQZjh332ZUY6xut0A
AlZCINMymDmg3LTNgoJdieFpgkYfmDrLPWIKMIWU3qNqhxfN5QL715NBOYSUEgZF
kxCQT0AB0KRyDWWaDkH3FsUZFsvygY2OTI8QfraTVFlh3SSRkn/To7l0CVFnM4B9
qmWLMe+4QMmwGR162WYu+Xmppl8=
-----END CERTIFICATE-----

View File

@ -3,15 +3,29 @@ use strict;
use warnings;
use v5.14;
our $ndd = "netlib.re";
our $domain = "montest.netlib.re";
our $name = "www";
our $ttl = "3600";
our $login = "test";
our $pass = "test";
# the website sending your current IP address
our $checkip = "http://t.karchnu.fr/ip.php";
# Domain name of the service provider (like netlib.re)
our $nddservice = "netlib.re";
# 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 {
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;
for(@tmp_ip) {
@ -25,35 +39,14 @@ sub get_ip {
sub update {
my $ip = get_ip;
my $type;
if($ip =~ /:/) {
$type = "AAAA";
}
else {
$type = "A";
}
my $todig;
if($name =~ '@') {
$todig = $domain;
}
else {
$todig = "$name.$domain";
}
say "UPDATE :: domain $name.$domain => IP $ip, type $type";
my $oldhost = `dig +short $todig`;
chomp $oldhost;
say "domain $domain";
say "name $name";
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`;
my $cmd = "wget -O - ";
$cmd .=
"https://$nddservice/domain/cliup/$login/$pass/$domain/$name/$type/$ip ";
$cmd .= "--ca-certificate=$cacert";
say `$cmd`;
}
update;