nsm_server_backup-config automation

46 views
Skip to first unread message

Jason

unread,
Jul 20, 2014, 1:26:41 PM7/20/14
to securit...@googlegroups.com
Hello,

In my efforts to automate this script for DR and change management I ran into trouble with the "-y" and "--force-yes" options. nothing worked, until.

What I have done to make this work is modify the /usr/sbin/nsm_server_backup-config file.

the line I modified to make things work is line # 170;
I changed
if [ "$PROMPT_RET" != "Y" -a "PROMPT_RET" != "y" ]
to
if [ "$PROMPT_RET" != "N" -a "PROMPT_RET" != "n" ]
and everything seams to work as expected now.

Is this a sound change, or might I cause other issues by doing this?

Many thanks in advance for any feedback,
Jason

Doug Burks

unread,
Jul 22, 2014, 8:41:31 AM7/22/14
to securit...@googlegroups.com
Hi Jason,

It looks like the "-y" and "--force-yes" options set a variable called
FORCE_YES:

"-y" | "--force-yes")
FORCE_YES=yes

But it looks like that variable is never checked before prompting the user:

# prompt to backup the configuration
prompt_user_yesno "Backup Server Configuration" "All configurations
for server \"$SERVER_NAME\" will be backed up to:\n$BACKUP_FILE\n\nDo
you want to continue?" "N"
[ "$?" -ne 0 ] && exit 1
if [ "$PROMPT_RET" != "Y" -a "$PROMPT_RET" != "y" ]
then
exit 1
fi

So I think the proper way to fix this is to add a check for FORCE_YES
that would avoid prompting the user.

I've created Issue 561 to work on this:
https://code.google.com/p/security-onion/issues/detail?id=561

and added it to the Roadmap:
https://code.google.com/p/security-onion/wiki/Roadmap
> --
> You received this message because you are subscribed to the Google Groups "security-onion" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to security-onio...@googlegroups.com.
> To post to this group, send email to securit...@googlegroups.com.
> Visit this group at http://groups.google.com/group/security-onion.
> For more options, visit https://groups.google.com/d/optout.



--
Doug Burks
http://securityonionsolutions.com
Reply all
Reply to author
Forward
0 new messages