From f9d2acf0252633c7964288a1367defebc024d90b Mon Sep 17 00:00:00 2001 From: Kristofer Hallin Date: Thu, 5 May 2022 19:16:47 +0000 Subject: [PATCH] Minimal snmpd configuration for the Docker containers. Also change the pid-dir to /var/run/ since that is what all the tests are expecting. Can we pass the tests now? --- docker/main/Dockerfile | 8 +++++--- docker/main/Dockerfile.fcgi | 8 +++++--- docker/main/Dockerfile.native | 8 +++++--- docker/main/startsystem.sh | 2 +- docker/main/startsystem_fcgi.sh | 2 +- docker/main/startsystem_native.sh | 2 +- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index f9da28f2..07e9ecc3 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -122,9 +122,11 @@ RUN apk add --update flex bison fcgi-dev RUN apk add --update net-snmp net-snmp-tools # Some custom configuration for SNMP -RUN sed -i 's/#rocommunity public localhost/rocommunity public localhost/' /etc/snmp/snmpd.conf -RUN echo "agentXSocket unix:/var/run/snmp.sock" >> /etc/snmpd.conf -RUN echo "agentxperms 777 777" >> /etc/snmpd.conf +RUN echo "master agentx" > /etc/snmp/snmpd.conf +RUN echo "agentaddress 127.0.0.1" >> /etc/snmp/snmpd.conf +RUN echo "rwcommunity public localhost" >> /etc/snmp/snmpd.conf +RUN echo "agentXSocket unix:/var/run/snmp.sock" >> /etc/snmp/snmpd.conf +RUN echo "agentxperms 777 777" >> /etc/snmp/snmpd.conf # Test-specific (for test scripts) RUN apk add --update sudo curl procps grep make bash expect diff --git a/docker/main/Dockerfile.fcgi b/docker/main/Dockerfile.fcgi index 06014dda..7e227a94 100644 --- a/docker/main/Dockerfile.fcgi +++ b/docker/main/Dockerfile.fcgi @@ -123,9 +123,11 @@ RUN apk add --update flex bison fcgi-dev RUN apk add --update net-snmp net-snmp-tools # Some custom configuration for SNMP -RUN sed -i 's/#rocommunity public localhost/rocommunity public localhost/' /etc/snmp/snmpd.conf -RUN echo "agentXSocket unix:/var/run/snmp.sock" >> /etc/snmpd.conf -RUN echo "agentxperms 777 777" >> /etc/snmpd.conf +RUN echo "master agentx" > /etc/snmp/snmpd.conf +RUN echo "agentaddress 127.0.0.1" >> /etc/snmp/snmpd.conf +RUN echo "rwcommunity public localhost" >> /etc/snmp/snmpd.conf +RUN echo "agentXSocket unix:/var/run/snmp.sock" >> /etc/snmp/snmpd.conf +RUN echo "agentxperms 777 777" >> /etc/snmp/snmpd.conf # Need to add www user manually, but group www-data already exists on Alpine RUN adduser -D -H -G www-data www-data diff --git a/docker/main/Dockerfile.native b/docker/main/Dockerfile.native index 1e77913f..f9f5fc82 100644 --- a/docker/main/Dockerfile.native +++ b/docker/main/Dockerfile.native @@ -146,9 +146,11 @@ RUN apk add --update sudo curl procps grep make bash expect RUN apk add --update net-snmp net-snmp-tools # Some custom configuration for SNMP -RUN sed -i 's/#rocommunity public localhost/rocommunity public localhost/' /etc/snmp/snmpd.conf -RUN echo "agentXSocket unix:/var/run/snmp.sock" >> /etc/snmpd.conf -RUN echo "agentxperms 777 777" >> /etc/snmpd.conf +RUN echo "master agentx" > /etc/snmp/snmpd.conf +RUN echo "agentaddress 127.0.0.1" >> /etc/snmp/snmpd.conf +RUN echo "rwcommunity public localhost" >> /etc/snmp/snmpd.conf +RUN echo "agentXSocket unix:/var/run/snmp.sock" >> /etc/snmp/snmpd.conf +RUN echo "agentxperms 777 777" >> /etc/snmp/snmpd.conf # Expose https port for restconf EXPOSE 80/tcp diff --git a/docker/main/startsystem.sh b/docker/main/startsystem.sh index 1781620a..b6c2df96 100755 --- a/docker/main/startsystem.sh +++ b/docker/main/startsystem.sh @@ -84,7 +84,7 @@ chmod 775 /usr/local/bin/test/site.sh # Start snmpd, we need this for the SNMP tests and the app clixon_snmp. Log to stdout, then we can # use Docker logs to see what's happening. -snmpd -Lo -p /run/snmpd.pid +snmpd -Lo -p /var/run/snmpd.pid # Alt: let backend be in foreground, but test scripts may # want to restart backend diff --git a/docker/main/startsystem_fcgi.sh b/docker/main/startsystem_fcgi.sh index 1bfa9268..b3339b9e 100755 --- a/docker/main/startsystem_fcgi.sh +++ b/docker/main/startsystem_fcgi.sh @@ -132,7 +132,7 @@ chmod g+w /www-data/fastcgi_restconf.sock # Start snmpd, we need this for the SNMP tests and the app clixon_snmp. Log to stdout, then we can # use Docker logs to see what's happening. -snmpd -Lo -p /run/snmpd.pid +snmpd -Lo -p /var/run/snmpd.pid # Alt: let backend be in foreground, but test scripts may # want to restart backend diff --git a/docker/main/startsystem_native.sh b/docker/main/startsystem_native.sh index c60a837e..13e476eb 100755 --- a/docker/main/startsystem_native.sh +++ b/docker/main/startsystem_native.sh @@ -127,7 +127,7 @@ openssl req -x509 -config ./ca.cnf -nodes -newkey rsa:4096 -keyout /etc/ssl/priv # Start snmpd, we need this for the SNMP tests and the app clixon_snmp. Log to stdout, then we can # use Docker logs to see what's happening. -snmpd -Lo -p /run/snmpd.pid +snmpd -Lo -p /var/run/snmpd.pid # Alt: let backend be in foreground, but test scripts may # want to restart backend