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.

31 lines
1.1KB

  1. #!/bin/bash
  2. # Set consumption directory
  3. mkdir -p ${PAPERLESS_CONSUMPTION_DIR}
  4. # set FTP user password from secret
  5. if [ ! -z ${PAPERLESS_FTP_PWD_FILE} -a -f ${PAPERLESS_FTP_PWD_FILE} ]; then
  6. PAPERLESS_FTP_PWD=`cat $PAPERLESS_FTP_PWD_FILE`;
  7. fi
  8. # create FTP user
  9. useradd -d ${PAPERLESS_CONSUMPTION_DIR} -p `openssl passwd -1 ${PAPERLESS_FTP_PWD}` ${PAPERLESS_FTP_USER}
  10. chown ${PAPERLESS_FTP_USER} ${PAPERLESS_CONSUMPTION_DIR}
  11. chmod 777 ${PAPERLESS_CONSUMPTION_DIR}
  12. # Copy Server Host key if any (this is needed at least for Brother ADS-2400n)
  13. if [[ -s ${PAPERLESS_CONSUMPTION_DIR}/ssh_host_rsa_key.pub ]]; then
  14. cp ${PAPERLESS_CONSUMPTION_DIR}/ssh_host_rsa_key.pub /etc/ssh/;
  15. fi
  16. if [[ -s ${PAPERLESS_CONSUMPTION_DIR}/ssh_host_rsa_key ]]; then
  17. cp ${PAPERLESS_CONSUMPTION_DIR}/ssh_host_rsa_key /etc/ssh/;
  18. fi
  19. sed -i 's/#HostKey \/etc\/ssh\/ssh_host_rsa_key/HostKey \/etc\/ssh\/ssh_host_rsa_key/g' /etc/ssh/sshd_config
  20. echo "HostKeyAlgorithms ssh-rsa" >> /etc/ssh/sshd_config
  21. # https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/45234
  22. mkdir -p /var/run/sshd
  23. exec "$@"