Commit 28b0dbe1 authored by Alessandro Rubini's avatar Alessandro Rubini

build: fix snmpd.conf according to Kconfig values

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 66ebef62
......@@ -71,6 +71,44 @@ config REMOTE_SYSLOG_UDP
help
Select UDP to send system logs. If not set, TCP is used.
config SNMP_TRAPSINK_ADDRESS
string "Static IP address or name where to send SNMPv1 traps"
help
If not empty, the address or name is ussed as "trapsink"
destination in the SNMP configuration file for the switch.
It empty, no v1 traps are generated. If both this and
the following TRAP2SINK_ADDRESS are set, snmpd sends two
traps (one per protocol version). Trapcommunity is "public"
(not configurable so far).
config SNMP_TRAP2SINK_ADDRESS
string "Static IP address or name where to send SNMPv2c traps"
help
If not empty, the address or name is ussed as "trap2sink"
destination in the SNMP configuration file for the switch.
It empty, no v2c traps are generated. Trapcommunity is "public"
(not configurable so far).
config SNMP_RO_COMMUNITY
string "Read-only community name for SNMP V1/V2 management"
default "public"
help
If not empty, the 'community' name is a sort of password,
that travels as clear text (we don't support encrypted SNMPv3
yet). The default is good for testing, but should be changed
for production. Please note, however, that the switch processes
SNMP only on the CPU Ethernet port (the copper "management" port).
config SNMP_RW_COMMUNITY
string "Read-write community name for SNMP V1/V2 management"
default "private"
help
If not empty, the 'community' name is a sort of password,
that travels as clear text (we don't support encrypted SNMPv3
yet). The default is good for testing, but should be changed
for production. Please note, however, that the switch processes
SNMP only on the CPU Ethernet port (the copper "management" port).
config KEEP_ROOTFS
bool "Keep generated filesystem and related script"
help
......
......@@ -29,6 +29,7 @@ TMPSCRIPT=$(mktemp /tmp/rootfs-script.XXXXXX)
ROOTFS_IMAGE_TGZ="$WRS_OUTPUT_DIR/images/wrs-image.tar.gz"
cat > $TMPSCRIPT << EOF
. $WRS_BASE_DIR/../.config
mkdir -p $TMPFS/wr
cp -r $rootfs_vanilla/* $TMPFS
......@@ -61,6 +62,14 @@ if [ ! -z "$CONFIG_REMOTE_SYSLOG_SERVER" ]; then
sed -i 's/remote-host/$CONFIG_REMOTE_SYSLOG_SERVER/' $TMPFS/etc/rsyslog.conf
fi
# Fix SNMP values: for all not-empty configs remove commend and replace value
cfgfile="$TMPFS/wr/etc/snmpd.conf"
set | grep CONFIG_SNMP | sed 's/=/ /' | while read varname value; do
if [ -z "\$value" ]; then continue; fi
sed -i "/\$varname/ s/^#//" \$cfgfile
sed -i "/\$varname/ s/\$varname/\$value/" \$cfgfile
done
mkdir -p $TMPFS/root/.ssh
#cat $HOME/.ssh/id_?sa.pub >> $TMPFS/root/.ssh/authorized_keys
if [ -f $WRS_BASE_DIR/authorized_keys ]; then
......
# snmpd.conf
#
# - created by the snmpconf configuration program
# - manually edited to simplify it
# - manually edited to simplify it a lot
# - edited using Kconfig values at switch build time
#
agentAddress udp::161
#trapsink CONFIG_TRAPSINK_ADDRESS
#trapsink CONFIG_SNMP_TRAPSINK_ADDRESS
#trap2sink CONFIG_SNMP_TRAP2SINK_ADDRESS
trapcommunity public
authtrapenable 1
rocommunity public
rwcommunity private
#rocommunity CONFIG_SNMP_RO_COMMUNITY
#rwcommunity CONFIG_SNMP_RW_COMMUNITY
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