Gentlemen,
I am trying to propagate FR configurations from a single machine that interfaces with a WWW form. After my perl script writes the FR configuration file, I use this propagate function to write the configuation file to other hosts. I am using RSA keys to automate the authentication of scp, and when i use scp or ssh in an interactive session, I am authenticated without problem.
Code is posted below, but when it runs, I get this error in my /var/log/httpd/error_log:
Could not create directory '/var/www/.ssh'.
Host key verification failed.
lost connection
This is the offending code:
sub propagate {
my $config_file = shift;
my $addr;
my %FR_servers = ( "XX.XX.XX.XX" => 0 ); # key: address o
+f FR servs val: sucess/fail
####### Begin Dumb Propagate Function #######
foreach $addr (keys %FR_servers) {
if( system("scp $config_file $addr:/usr/local/etc/radd
+b/") == 0 ){
$FR_servers{$addr} = 1; # mark
+ for user feedback
print "good<br>";
system("ssh $addr \"$reloadcmd\""); # relo
+ad freeradius remotely
} else { $FR_servers{$addr} = 0; print "bad<br>"; }
}
####### Finish Dumb Propagate Function #######
####### Draw Propagate Results #######
$query->header();
foreach $addr (keys %FR_servers){
print "$_ $FR_servers{$addr}<br>";
}
}
Thanks in advance
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.