ftp/sftpgo: SFTP, FTP/S, and WebDAV server [NEW]

Fully featured and highly configurable SFTP server with optional FTP/S
and WebDAV support, written in Go. Several storage backends are
supported: local filesystem, encrypted local filesystem,
S3 (compatible) Object Storage, Google Cloud Storage,
Azure Blob Storage, SFTP.

WWW: https://github.com/drakkan/sftpgo

Approved by:	koobs
Differential Revision:	https://reviews.freebsd.org/D30661
This commit is contained in:
Serhii (Sergey) Kozlov 2021-06-04 16:06:23 +00:00
parent d914f7bb38
commit a72b75c84c
8 changed files with 197 additions and 2 deletions

2
GIDs
View file

@ -231,7 +231,7 @@ ntopng:*:288:
victoria-metrics:*:289:
_gmid:*:290:
pydio:*:291:
# free: 292
sftpgo:*:292:
# free: 293
# free: 294
# free: 295

2
UIDs
View file

@ -236,7 +236,7 @@ ntopng:*:288:288::0:0:ntopng daemon user:/nonexistent:/usr/sbin/nologin
victoria-metrics:*:289:289::0:0:VictoriaMetrics user:/nonexistent:/usr/sbin/nologin
_gmid:*:290:290::0:0:gmid daemon user:/var/empty:/usr/sbin/nologin
pydio:*:291:291::0:0:pydio cells user:/var/pydio:/bin/sh
# free: 292
sftpgo:*:292:292::0:0:SFTPGo user:/nonexistent:/usr/sbin/nologin
# free: 293
# free: 294
# free: 295

View file

@ -75,6 +75,7 @@
SUBDIR += rexx-curl
SUBDIR += rubygem-curb
SUBDIR += rubygem-net-ftp
SUBDIR += sftpgo
SUBDIR += smbftpd
SUBDIR += spegla
SUBDIR += tftp-hpa

66
ftp/sftpgo/Makefile Normal file
View file

@ -0,0 +1,66 @@
PORTNAME= sftpgo
PORTVERSION= 2.0.4
CATEGORIES= ftp www
MASTER_SITES= https://github.com/drakkan/${PORTNAME}/releases/download/v${DISTVERSION}/
DISTNAME= ${PORTNAME}_v${PORTVERSION}_src_with_deps
MAINTAINER= skozlov@FreeBSD.org
COMMENT= Fully featured and highly configurable SFTP, FTP/S, and WebDAV server
LICENSE= AGPLv3
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= go:modules tar:xz
USE_RC_SUBR= ${PORTNAME}
NO_WRKSUBDIR= yes
OPTIONS_DEFINE= BASH FISH ZSH MANPAGES
OPTIONS_DEFAULT= BASH FISH ZSH MANPAGES
OPTIONS_SUB= yes
USERS= sftpgo
GROUPS= sftpgo
post-patch:
${REINPLACE_CMD} -e 's|"templates"|"${DATADIR}/templates"|; \
s|"static"|"${DATADIR}/static"|; \
s|"sftpgo.db"|"/var/db/${PORTNAME}/${PORTNAME}.db"|' \
${WRKSRC}/${PORTNAME}.json
post-build-BASH-on:
${GO_WRKDIR_BIN}/${PORTNAME} gen completion bash > ${WRKDIR}/bash_completions
post-build-FISH-on:
${GO_WRKDIR_BIN}/${PORTNAME} gen completion fish > ${WRKDIR}/fish_completions
post-build-ZSH-on:
${GO_WRKDIR_BIN}/${PORTNAME} gen completion zsh > ${WRKDIR}/zsh_completions
post-build-MANPAGES-on:
${MKDIR} ${WRKDIR}/manpages
${GO_WRKDIR_BIN}/${PORTNAME} gen man --dir ${WRKDIR}/manpages
post-install:
@${MKDIR} ${STAGEDIR}${DATADIR}
cd ${WRKSRC} && \
${COPYTREE_SHARE} templates ${STAGEDIR}${DATADIR} && \
${COPYTREE_SHARE} static ${STAGEDIR}${DATADIR}
${INSTALL_DATA} ${WRKSRC}/${PORTNAME}.json ${STAGEDIR}${PREFIX}/etc/${PORTNAME}.json.sample
post-install-BASH-on:
@${MKDIR} ${STAGEDIR}${PREFIX}/etc/bash_completion.d
${INSTALL_DATA} ${WRKDIR}/bash_completions ${STAGEDIR}${PREFIX}/etc/bash_completion.d/${PORTNAME}
post-install-FISH-on:
@${MKDIR} ${STAGEDIR}${PREFIX}/share/fish/completions
${INSTALL_DATA} ${WRKDIR}/fish_completions ${STAGEDIR}${PREFIX}/share/fish/completions/${PORTNAME}.fish
post-install-ZSH-on:
@${MKDIR} ${STAGEDIR}${PREFIX}/share/zsh/site-functions
${INSTALL_DATA} ${WRKDIR}/zsh_completions ${STAGEDIR}${PREFIX}/share/zsh/site-functions/_${PORTNAME}
post-install-MANPAGES-on:
${FIND} ${WRKDIR}/manpages -type f -execdir ${INSTALL_MAN} {} ${STAGEDIR}${MANPREFIX}/man/man1 \;
.include <bsd.port.mk>

3
ftp/sftpgo/distinfo Normal file
View file

@ -0,0 +1,3 @@
TIMESTAMP = 1622828171
SHA256 (sftpgo_v2.0.4_src_with_deps.tar.xz) = 6e76df02bae6a1e869b4ac8f35bd46dd07dc7085348cc6179430c3455751ec91
SIZE (sftpgo_v2.0.4_src_with_deps.tar.xz) = 7697892

View file

@ -0,0 +1,57 @@
#!/bin/sh
# PROVIDE: sftpgo
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable SFTPGo:
#
# sftpgo_enable (bool): Set to "NO" by default.
# Set to "YES" to enable SFTPGo.
# sftpgo_user (str): Default to "sftpgo".
# sftpgo_group (str): Default to "sftpgo".
# User and group to run SFTPGo with.
# sftpgo_flags (str): Additional flags to append to "sftpgo serve" command.
# Read sftpgo(1) for more information.
# sftpgo_config (str): Default to "%%PREFIX%%/etc/sftpgo.json".
# SFTPGo config directory.
# sftpgo_configdir (str): Default to "/var/db/sftpgo".
# Directory for private keys, SQLite database etc.
# sftpgo_logdir (str): Default to "/var/log/sftpgo".
# Directory to store sftpgo logs
. /etc/rc.subr
name=sftpgo
rcvar=sftpgo_enable
desc=SFTPGo
load_rc_config sftpgo
: ${sftpgo_enable:=NO}
: ${sftpgo_user:=sftpgo}
: ${sftpgo_group:=sftpgo}
: ${sftpgo_config=%%PREFIX%%/etc/sftpgo.json}
: ${sftpgo_configdir=/var/db/sftpgo}
: ${sftpgo_logdir=/var/log/sftpgo}
pidfile=/var/run/${name}/${name}.pid
start_precmd=sftpgo_precmd
procname="%%PREFIX%%/bin/sftpgo"
required_files="${sftpgo_config}"
command=/usr/sbin/daemon
command_args="-cf -p ${pidfile} ${procname} serve --config-dir ${sftpgo_configdir} --config-file ${sftpgo_config} --log-file-path ${sftpgo_logdir}/sftpgo.log ${sftpgo_flags}"
sftpgo_precmd()
{
# Create PID file directory
install -d -o ${sftpgo_user} -g ${sftpgo_group} -m 0755 "$(dirname ${pidfile})"
install -d -o ${sftpgo_user} -g ${sftpgo_group} -m 0755 "${sftpgo_configdir}"
install -d -o ${sftpgo_user} -g ${sftpgo_group} -m 0755 "${sftpgo_logdir}"
# Remove default flags, they're added in `command_args` manually
rc_flags=""
}
run_rc_command "$1"

6
ftp/sftpgo/pkg-descr Normal file
View file

@ -0,0 +1,6 @@
Fully featured and highly configurable SFTP server with optional FTP/S and
WebDAV support, written in Go. Several storage backends are supported:
local filesystem, encrypted local filesystem, S3 (compatible) Object Storage,
Google Cloud Storage, Azure Blob Storage, SFTP.
WWW: https://github.com/drakkan/sftpgo

62
ftp/sftpgo/pkg-plist Normal file
View file

@ -0,0 +1,62 @@
bin/sftpgo
%%BASH%%etc/bash_completion.d/sftpgo
@sample etc/sftpgo.json.sample
%%MANPAGES%%man/man1/sftpgo-gen-completion.1.gz
%%MANPAGES%%man/man1/sftpgo-gen-man.1.gz
%%MANPAGES%%man/man1/sftpgo-gen.1.gz
%%MANPAGES%%man/man1/sftpgo-initprovider.1.gz
%%MANPAGES%%man/man1/sftpgo-portable.1.gz
%%MANPAGES%%man/man1/sftpgo-revertprovider.1.gz
%%MANPAGES%%man/man1/sftpgo-serve.1.gz
%%MANPAGES%%man/man1/sftpgo-startsubsys.1.gz
%%MANPAGES%%man/man1/sftpgo.1.gz
%%FISH%%share/fish/completions/sftpgo.fish
%%DATADIR%%/static/css/fonts.css
%%DATADIR%%/static/css/sb-admin-2.min.css
%%DATADIR%%/static/favicon.ico
%%DATADIR%%/static/img/undraw_profile.svg
%%DATADIR%%/static/js/sb-admin-2.js
%%DATADIR%%/static/js/sb-admin-2.min.js
%%DATADIR%%/static/vendor/bootstrap/js/bootstrap.bundle.min.js
%%DATADIR%%/static/vendor/bootstrap/js/bootstrap.min.js
%%DATADIR%%/static/vendor/datatables/buttons.bootstrap4.min.css
%%DATADIR%%/static/vendor/datatables/buttons.bootstrap4.min.js
%%DATADIR%%/static/vendor/datatables/dataTables.bootstrap4.min.css
%%DATADIR%%/static/vendor/datatables/dataTables.bootstrap4.min.js
%%DATADIR%%/static/vendor/datatables/dataTables.buttons.min.js
%%DATADIR%%/static/vendor/datatables/dataTables.select.min.js
%%DATADIR%%/static/vendor/datatables/jquery.dataTables.min.js
%%DATADIR%%/static/vendor/datatables/select.bootstrap4.min.css
%%DATADIR%%/static/vendor/datatables/select.bootstrap4.min.js
%%DATADIR%%/static/vendor/fontawesome-free/css/fontawesome.min.css
%%DATADIR%%/static/vendor/fontawesome-free/css/solid.min.css
%%DATADIR%%/static/vendor/fontawesome-free/webfonts/fa-solid-900.eot
%%DATADIR%%/static/vendor/fontawesome-free/webfonts/fa-solid-900.svg
%%DATADIR%%/static/vendor/fontawesome-free/webfonts/fa-solid-900.ttf
%%DATADIR%%/static/vendor/fontawesome-free/webfonts/fa-solid-900.woff
%%DATADIR%%/static/vendor/fontawesome-free/webfonts/fa-solid-900.woff2
%%DATADIR%%/static/vendor/fonts/LICENSE.txt
%%DATADIR%%/static/vendor/fonts/README.txt
%%DATADIR%%/static/vendor/fonts/Roboto-Bold-webfont.woff
%%DATADIR%%/static/vendor/fonts/Roboto-Light-webfont.woff
%%DATADIR%%/static/vendor/fonts/Roboto-Regular-webfont.woff
%%DATADIR%%/static/vendor/jquery-easing/jquery.easing.compatibility.js
%%DATADIR%%/static/vendor/jquery-easing/jquery.easing.min.js
%%DATADIR%%/static/vendor/jquery/jquery.min.js
%%DATADIR%%/static/vendor/moment/js/moment.min.js
%%DATADIR%%/static/vendor/tempusdominus/css/tempusdominus-bootstrap-4.min.css
%%DATADIR%%/static/vendor/tempusdominus/js/tempusdominus-bootstrap-4.min.js
%%DATADIR%%/templates/admin.html
%%DATADIR%%/templates/admins.html
%%DATADIR%%/templates/base.html
%%DATADIR%%/templates/changepwd.html
%%DATADIR%%/templates/connections.html
%%DATADIR%%/templates/folder.html
%%DATADIR%%/templates/folders.html
%%DATADIR%%/templates/login.html
%%DATADIR%%/templates/maintenance.html
%%DATADIR%%/templates/message.html
%%DATADIR%%/templates/status.html
%%DATADIR%%/templates/user.html
%%DATADIR%%/templates/users.html
%%ZSH%%share/zsh/site-functions/_sftpgo