GNS3 Docker Images
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.

Dockerfile 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. FROM debian:stretch-slim
  2. RUN set -e -x \
  3. #
  4. # install ftp, tftp and ssh server
  5. #
  6. && export DEBIAN_FRONTEND=noninteractive \
  7. && apt-get update \
  8. && echo 'proftpd-basic shared/proftpd/inetd_or_standalone string standalone' | debconf-set-selections \
  9. && apt-get -y --no-install-recommends install \
  10. dumb-init proftpd-basic tftpd-hpa openssh-server \
  11. net-tools iproute2 ifupdown isc-dhcp-client inetutils-ping \
  12. telnet traceroute procps nano vim-tiny \
  13. && rm -rf /var/lib/apt/lists/* \
  14. #
  15. # setup ftp, tftp and openssh
  16. #
  17. && addgroup --system ftp \
  18. && usermod -d /ftp -g ftp -s /bin/bash ftp \
  19. && printf 'ftp\nftp\n' | passwd ftp 2> /dev/null \
  20. && printf '\
  21. \043 A basic anonymous configuration, no security !!!\n\
  22. \n\
  23. <Anonymous ~ftp>\n\
  24. User ftp\n\
  25. Group ftp\n\
  26. \043 We want clients to be able to login with "anonymous" as well as "ftp"\n\
  27. UserAlias anonymous ftp\n\
  28. \n\
  29. \043 Don\047t require valid shell for anonymous user\n\
  30. RequireValidShell off\n\
  31. \n\
  32. \043 Limit the maximum number of anonymous logins\n\
  33. MaxClients 10\n\
  34. \n\
  35. \043 We want "welcome.msg" displayed at login, and ".message" displayed\n\
  36. \043 in each newly chdired directory.\n\
  37. DisplayLogin welcome.msg\n\
  38. DisplayChdir .message\n\
  39. \n\
  40. </Anonymous>\n' \
  41. > /etc/proftpd/conf.d/anonymous.conf \
  42. \
  43. && printf '\
  44. \043 /etc/default/tftpd-hpa\n\
  45. \n\
  46. TFTP_USERNAME="ftp"\n\
  47. TFTP_DIRECTORY="/ftp"\n\
  48. TFTP_ADDRESS=":69"\n\
  49. TFTP_OPTIONS="--secure --permissive --create --umask 022"\n' \
  50. > /etc/default/tftpd-hpa \
  51. \
  52. && printf '\
  53. \n\
  54. Ciphers +aes256-cbc\n\
  55. KexAlgorithms +diffie-hellman-group1-sha1\n\
  56. \n\
  57. AllowUsers ftp\n' >> /etc/ssh/sshd_config \
  58. && rm -f /etc/ssh/ssh_host_* \
  59. #
  60. # startup script
  61. #
  62. && printf '\
  63. \043!/bin/sh\n\
  64. [ $$ -eq 1 ] && exec dumb-init -- "$0" "$@"\n\
  65. \n\
  66. \043 try to set ftp to same user/group id as GNS3 process\n\
  67. \043 /etc/network/interfaces is managed by GNS3\n\
  68. uid=$(stat -c %%u /etc/network/interfaces 2> /dev/null)\n\
  69. if [ "0$uid" -ne 0 ]; then\n\
  70. gid=$(stat -c %%g /etc/network/interfaces)\n\
  71. usermod -o -u "$uid" ftp\n\
  72. groupmod -o -g "$gid" ftp\n\
  73. fi\n\
  74. \n\
  75. \043 create /ftp directory\n\
  76. mkdir -p /ftp\n\
  77. chown ftp:ftp /ftp\n\
  78. chmod 775 /ftp\n\
  79. \n\
  80. \043 create missing SSH keys\n\
  81. ssh-keygen -A\n\
  82. \n\
  83. \043 start ftp, tftp and ssh services\n\
  84. service proftpd start\n\
  85. service tftpd-hpa start\n\
  86. service ssh start\n\
  87. \n\
  88. cd; exec bash -i\n' \
  89. > /etc/init.sh && chmod +x /etc/init.sh
  90. VOLUME [ "/etc/ssh", "/ftp" ]
  91. CMD [ "/etc/init.sh" ]