Commit 64f2aa74 authored by Dietmar Maurer's avatar Dietmar Maurer

write auth.conf

parent 60d3dcce
...@@ -173,6 +173,15 @@ sub read_etc_pve_subscription { ...@@ -173,6 +173,15 @@ sub read_etc_pve_subscription {
return $info; return $info;
} }
sub write_apt_auth {
my $key = shift;
my $server_id = get_hwaddress();
my $auth = { 'enterprise.proxmox.com' => { login => $key, password => get_hwaddress() } };
PVE::INotify::update_file('apt-auth', $auth);
}
sub write_etc_pve_subscription { sub write_etc_pve_subscription {
my ($filename, $fh, $info) = @_; my ($filename, $fh, $info) = @_;
...@@ -188,6 +197,8 @@ sub write_etc_pve_subscription { ...@@ -188,6 +197,8 @@ sub write_etc_pve_subscription {
my $raw = "$info->{key}\n$csum\n$data"; my $raw = "$info->{key}\n$csum\n$data";
PVE::Tools::safe_print($filename, $fh, $raw); PVE::Tools::safe_print($filename, $fh, $raw);
write_apt_auth($info->{key});
} }
sub check_subscription { sub check_subscription {
...@@ -329,6 +340,8 @@ __PACKAGE__->register_method ({ ...@@ -329,6 +340,8 @@ __PACKAGE__->register_method ({
my $info = PVE::INotify::read_file('subscription'); my $info = PVE::INotify::read_file('subscription');
return undef if !$info; return undef if !$info;
write_apt_auth($info->{key}) if $info->{key};
if (!$param->{force} && $info->{status} eq 'Active') { if (!$param->{force} && $info->{status} eq 'Active') {
my $age = time() - $info->{checktime}; my $age = time() - $info->{checktime};
return undef if $age < $localkeydays*60*60*24; return undef if $age < $localkeydays*60*60*24;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment