MT#7367 SSH will listen 0.0.0.0 for Vagrant VMs (DHCP case)

In case of DHCP server is being used, and system was rebooted
with new IP, network.yml still has old IP and SSH will listen old IP only.
Vagrant cannot connect VM using old IP to change it to new one.

In case of CE with one network interface (common case)
ngcp-eadresss will update network.yml and apply new config.

PRO should not be installed using DHCP (at least in production).

Vagrant VMs has two interfaces, so ngcp-eadresss does nothing,
so we add option to config.yml which overwrites ssh_ext types in
network.yml.
vseva/8067
Alexander Lutay 11 years ago
parent 8b7d879a93
commit 84161ebda6

@ -1985,7 +1985,7 @@ use YAML::Tiny;
my $yaml = YAML::Tiny->new;
my $inputfile = "/etc/ngcp-config/config.yml";
my $outputfile = "/etc/ngcp-config/config.yml";
my $outputfile = $inputfile;
$yaml = YAML::Tiny->read($inputfile) or die "File $inputfile could not be read";
@ -2004,6 +2004,25 @@ print $fh $yaml->write_string() or die "Could not write YAML to $outputfile";
EOF
fi
# CE
chroot "$TARGET" perl -wCSD << "EOF"
use strict;
use warnings;
use YAML::Tiny;
my $yaml = YAML::Tiny->new;
my $inputfile = "/etc/ngcp-config/config.yml";
my $outputfile = $inputfile;
$yaml = YAML::Tiny->read($inputfile) or die "File $inputfile could not be read";
# Enable SSH on all IPs/interfaces (0.0.0.0)
push @{$yaml->[0]->{sshd}->{listen_addresses}}, '0.0.0.0';
open(my $fh, ">", "$outputfile") or die "Could not open $outputfile for writing";
print $fh $yaml->write_string() or die "Could not write YAML to $outputfile";
EOF
# record configuration file changes
chroot "$TARGET" etckeeper commit "Snapshot after enabling VM defaults [$(date)]" || true
chroot "$TARGET" bash -c "cd /etc/ngcp-config ; git commit -a -m \"Snapshot after enabling VM defaults [$(date)]\" || true"

Loading…
Cancel
Save