#!/bin/sh -e

##########################################################################
#   Title:
#       Optional, defaults to the name of the script sans extention
#
#   Section:
#       8
#
#   Synopsis:
#       
#   Description:
#       Enable/disable remote access via ipmitool
#       
#   Arguments:
#       
#   Returns:
#
#   Examples:
#
#   Files:
#
#   Environment:
#
#   See also:
#       
#   History:
#   Date        Name        Modification
#   2020-02-23  Jason Bacon Begin
#   2024-11-12  Jason Bacon Add man page template and usage
##########################################################################

usage()
{
    printf "Usage: $0 on|off\n"
    exit 1
}


##########################################################################
#   Main
##########################################################################

if [ $# != 1 ]; then
    usage
fi

auto-root-check $0

state="$1"
case "$state" in
on|off)
    ;;
*)
    usage
    ;;
esac

cat << EOM

Note: For security reasons, you may need to enable IPMI over LAN via the
console.

For example, on Dell PowerEdge systems, enter the iDrac settings when
prompted during bootup (Ctrl+E) and make sure IPMI over LAN is enabled in
the menu.

You must also configure network settings using a tool such as
auto-idrac-config and an IPMI password using a tool such as
auto-ipmi-password.

EOM

# http://lists.us.dell.com/pipermail/linux-poweredge/2007-August/032915.html
# FIXME: Is -I open a good idea here?  It was in an example.
ipmitool lan set 1 access $state
