Wednesday, June 07, 2023

Re: Question about net/curl and SFTP

On Wed, Jun 07, 2023 at 12:19:19PM -0600, Abel Abraham Camarillo Ojeda wrote:
> On Wed, Jun 7, 2023 at 11:48 AM Allan Streib <astreib@fastmail.fm> wrote:
>
> > On Wed, Jun 7, 2023, at 12:37, Vlad Meșco wrote:
> >
> > > Curl is built without sftp or scp support; my guess is because "why
> > > would you?"
> >
> > I would just use the sftp utility itself, except it doesn't allow
> > reading the standard input for the data to transfer. curl does,
> > thus my attempt to use it in this scenario.
> >
> > > You can do what I did: grab the ports tree, update net/curl/Makefile to
> > > configure --with-libssh (and add libssh as a dependency), make package
> > > and make install.
> >
> > Yes, that's fine, I can do that. I guess I assumed there might be some
> > other (breaking) reason that it was disabled. Thanks!
> >
> > Allan
> >
> >
> You can also use plain ssh with something like:
>
> program | ssh -n user@host 'cat > /route/to/destfile'

I agree with Abel, that's the best choice if you can ssh into the box
(which is usually the case.) Although I think the use of `-n' in this
case is dubious (doesn't that disconnect stdin?)

If the target only allows SFTP and you want curl, I've attached my local
patch.

Theo made a point about not compiling everything into everything else,
so do prefer using ssh and sftp over curl-with-all-protocols.

Vlad



Index: Makefile
===================================================================
RCS file: /cvs/ports/net/curl/Makefile,v
retrieving revision 1.180.2.2
diff -u -p -u -p -r1.180.2.2 Makefile
--- Makefile 18 May 2023 14:03:36 -0000 1.180.2.2
+++ Makefile 7 Jun 2023 18:22:42 -0000
@@ -5,6 +5,8 @@ SHARED_LIBS= curl 26.20
CATEGORIES= net
HOMEPAGE= https://curl.se/

+REVISION=1
+
MAINTAINER= Christian Weisgerber <naddy@openbsd.org>

# MIT
@@ -13,9 +15,9 @@ PERMIT_PACKAGE= Yes
MASTER_SITES= https://curl.se/download/
EXTRACT_SUFX= .tar.xz

-LIB_DEPENDS= www/nghttp2 www/nghttp3 net/ngtcp2
+LIB_DEPENDS= www/nghttp2 www/nghttp3 net/ngtcp2 security/libssh
WANTLIB= c crypto pthread nghttp2 nghttp3 ngtcp2 ngtcp2_crypto_openssl
-WANTLIB+= ssl z
+WANTLIB+= ssl z ssh

AUTOCONF_VERSION=2.71
CONFIGURE_STYLE=autoconf
@@ -27,7 +29,7 @@ CONFIGURE_ARGS= --with-openssl \
--without-libgsasl \
--without-libidn2 \
--without-libpsl \
- --without-libssh \
+ --with-libssh \
--without-libssh2 \
--with-ngtcp2 \
--without-zstd

No comments:

Post a Comment