You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.0 KiB

  1. #!/bin/sh
  2. set -e
  3. # avoid problems with sudo path
  4. SYSREPOCFG=`which sysrepocfg`
  5. KS_KEY_NAME=genkey
  6. # check that there is no listen/Call Home configuration yet
  7. SERVER_CONFIG=`$SYSREPOCFG -X -x "/ietf-netconf-server:netconf-server/listen/endpoint[1]/name | /ietf-netconf-server:netconf-server/call-home/netconf-client[1]/name"`
  8. if [ -z "$SERVER_CONFIG" ]; then
  9. # import default config
  10. CONFIG="<netconf-server xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-server\">
  11. <listen>
  12. <endpoint>
  13. <name>default-ssh</name>
  14. <ssh>
  15. <tcp-server-parameters>
  16. <local-address>::</local-address>
  17. <keepalives>
  18. <idle-time>1</idle-time>
  19. <max-probes>10</max-probes>
  20. <probe-interval>5</probe-interval>
  21. </keepalives>
  22. </tcp-server-parameters>
  23. <ssh-server-parameters>
  24. <server-identity>
  25. <host-key>
  26. <name>default-key</name>
  27. <public-key>
  28. <keystore-reference>$KS_KEY_NAME</keystore-reference>
  29. </public-key>
  30. </host-key>
  31. </server-identity>
  32. <client-authentication>
  33. <supported-authentication-methods>
  34. <publickey/>
  35. <passsword/>
  36. <other>interactive</other>
  37. </supported-authentication-methods>
  38. <users/>
  39. </client-authentication>
  40. </ssh-server-parameters>
  41. </ssh>
  42. </endpoint>
  43. </listen>
  44. </netconf-server>"
  45. TMPFILE=`mktemp -u`
  46. printf -- "$CONFIG" > $TMPFILE
  47. # apply it to startup and running
  48. $SYSREPOCFG --edit=$TMPFILE -d startup -f xml -m ietf-netconf-server -v2
  49. $SYSREPOCFG -C startup -m ietf-netconf-server -v2
  50. # remove the tmp file
  51. rm $TMPFILE
  52. fi