How to resume a big file download in winscp from a fixed position - get

I want to know how to resume a big file download instantly using get command using winscp command line. I want to download a 30gb file out of which 22 gb is already completed. Now when I am resuming transfer it’s not starting instantly and after some time server is sending disconnect because of which not able to resume file transfer in get command. Please let me know if any setting is there in which I can instantly resume file transfer from last position of the downloaded file.
Below is the session log :
. 2020-12-08 13:50:42.255 --------------------------------------------------------------------------
. 2020-12-08 13:50:42.256 WinSCP Version 5.7.5 (Build 5665) (OS 6.3.9600 - Windows Server 2012 R2 Standard)
. 2020-12-08 13:50:42.257 Configuration: xx.ini
. 2020-12-08 13:50:42.258 Log level: Normal
. 2020-12-08 13:50:42.258 Local account: xx
. 2020-12-08 13:50:42.258 Working directory: xx
. 2020-12-08 13:50:42.258 Process ID: 33036
. 2020-12-08 13:50:42.258 Command-line: "xx\WinSCP.exe" /console=575 /consoleinstance=_26888_888 "/script=xx.txt" "/log=xx.log"
. 2020-12-08 13:50:42.258 Time zone: Current: GMT+5:30 (India Standard Time), No DST
. 2020-12-08 13:50:42.258 Login time: Tuesday, December 8, 2020 1:50:42 PM
. 2020-12-08 13:50:42.258 --------------------------------------------------------------------------
. 2020-12-08 13:50:42.258 Script: Retrospectively logging previous script records:
> 2020-12-08 13:50:42.258 Script: option batch abort
< 2020-12-08 13:50:42.258 Script: batch abort
< 2020-12-08 13:50:42.258 Script: reconnecttime 120
> 2020-12-08 13:50:42.258 Script: option confirm off
< 2020-12-08 13:50:42.258 Script: confirm off
> 2020-12-08 13:50:42.258 Script: open sftp://xx:xx#xxxxxx:xxxx -hostkey="ssh-rsa xx" -privatekey=xx.ppk -passphrase=xx -rawsettings Interface\SessionReopenAuto=40000000 SendBuf=0 SshSimple=0 -timeout=240
. 2020-12-08 13:50:42.258 --------------------------------------------------------------------------
. 2020-12-08 13:50:42.258 Session name:xxx#xxx (Ad-Hoc site)
. 2020-12-08 13:50:42.258 Host name:xx(Port: xx)
. 2020-12-08 13:50:42.259 User name: xx (Password: Yes, Key file: Yes)
. 2020-12-08 13:50:42.259 Tunnel: No
. 2020-12-08 13:50:42.259 Transfer Protocol: SFTP
. 2020-12-08 13:50:42.259 Ping type: -, Ping interval: 30 sec; Timeout: 240 sec
. 2020-12-08 13:50:42.259 Disable Nagle: No
. 2020-12-08 13:50:42.259 Proxy: none
. 2020-12-08 13:50:42.259 Send buffer: 0
. 2020-12-08 13:50:42.259 SSH protocol version: 2; Compression: No
. 2020-12-08 13:50:42.259 Bypass authentication: No
. 2020-12-08 13:50:42.259 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2020-12-08 13:50:42.259 Ciphers:X
. 2020-12-08 13:50:42.259 KEX: xx
. 2020-12-08 13:50:42.259 SSH Bugs: xxx
. 2020-12-08 13:50:42.259 Simple channel: No
. 2020-12-08 13:50:42.259 Return code variable: Autodetect; Lookup user groups: A
. 2020-12-08 13:50:42.259 Shell: default
. 2020-12-08 13:50:42.259 EOL: 0, UTF: 2
. 2020-12-08 13:50:42.259 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2020-12-08 13:50:42.259 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2020-12-08 13:50:42.259 SFTP Bugs: A,A
. 2020-12-08 13:50:42.259 SFTP Server: default
. 2020-12-08 13:50:42.259 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2020-12-08 13:50:42.259 Cache directory changes: Yes, Permanent: Yes
. 2020-12-08 13:50:42.259 DST mode: 1
. 2020-12-08 13:50:42.259 --------------------------------------------------------------------------
. 2020-12-08 13:50:42.260 Looking up host "xx"
. 2020-12-08 13:50:42.260 Connecting to xx port xxxx
. 2020-12-08 13:50:45.578 Server version: SSH-2.0-SFTP Server
. 2020-12-08 13:50:45.578 Using SSH protocol version 2
. 2020-12-08 13:50:45.578 We claim version: SSH-2.0-WinSCP_release_5.7.5
. 2020-12-08 13:50:47.299 Doing Diffie-Hellman group exchange
. 2020-12-08 13:50:51.570 Doing Diffie-Hellman key exchange with hash SHA-256
. 2020-12-08 13:50:53.394 Verifying host key rsa2 xxx
. 2020-12-08 13:50:53.397 Host key matches configured key
. 2020-12-08 13:50:53.397 Host key fingerprint is:
. 2020-12-08 13:50:53.397 xxxx
. 2020-12-08 13:50:53.397 Initialised AES-256 SDCTR client->server encryption
. 2020-12-08 13:50:53.397 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2020-12-08 13:50:55.666 Initialised AES-256 SDCTR server->client encryption
. 2020-12-08 13:50:55.666 Initialised HMAC-SHA-256 server->client MAC algorithm
. 2020-12-08 13:50:57.262 Reading private key file "xx.ppk"
! 2020-12-08 13:50:57.265 Using username "xx".
. 2020-12-08 13:50:59.893 Offered public key
. 2020-12-08 13:51:02.047 Offer of public key accepted
! 2020-12-08 13:51:02.047 Authenticating with public key "xx"
. 2020-12-08 13:51:02.048 Prompt (passphrase, "SSH key passphrase", <no instructions>, "Passphrase for key "xx": ")
. 2020-12-08 13:51:02.048 Using configured passphrase.
. 2020-12-08 13:51:02.348 Sent public key signature
! 2020-12-08 13:51:03.280 Further authentication required
. 2020-12-08 13:51:03.280 Further authentication required
. 2020-12-08 13:51:03.280 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2020-12-08 13:51:03.280 Using stored password.
. 2020-12-08 13:51:03.281 Sent password
. 2020-12-08 13:51:04.034 Access granted
. 2020-12-08 13:51:04.034 Opening session as main channel
. 2020-12-08 13:51:04.382 Opened main channel
. 2020-12-08 13:51:05.251 Started a shell/command
. 2020-12-08 13:51:05.252 --------------------------------------------------------------------------
. 2020-12-08 13:51:05.252 Using SFTP protocol.
. 2020-12-08 13:51:05.255 Doing startup conversation with host.
> 2020-12-08 13:51:05.256 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2020-12-08 13:51:05.717 Type: SSH_FXP_VERSION, Size: 33, Number: -1
. 2020-12-08 13:51:05.718 SFTP version 3 negotiated.
. 2020-12-08 13:51:05.718 Unknown server extension xx.com="\n"
. 2020-12-08 13:51:05.718 We believe the server has signed timestamps bug
. 2020-12-08 13:51:05.718 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 string are not mandatory
. 2020-12-08 13:51:05.718 Getting current directory name.
. 2020-12-08 13:51:05.718 Getting real path for '.'
> 2020-12-08 13:51:05.718 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2020-12-08 13:51:07.387 Type: SSH_FXP_NAME, Size: 51, Number: 16
. 2020-12-08 13:51:07.388 Real path is '/'
. 2020-12-08 13:51:07.388 Startup conversation with host finished.
< 2020-12-08 13:51:07.388 Script: Active session: [1] xx#xx
> 2020-12-08 13:51:07.390 Script: cd /xx
. 2020-12-08 13:51:07.390 Cached directory change via "/xx" to "/xx".
. 2020-12-08 13:51:07.390 Getting current directory name.
< 2020-12-08 13:51:07.390 Script: /xx
> 2020-12-08 13:51:07.391 Script: lcd xxx
< 2020-12-08 13:51:07.391 Script: xxx
> 2020-12-08 13:51:07.391 Script: get -resume -resumesupport=on -speed=256 xxx.xxx
. 2020-12-08 13:51:07.392 Listing file "xxx.xxx".
> 2020-12-08 13:51:07.392 Type: SSH_FXP_LSTAT, Size: 49, Number: 263
< 2020-12-08 13:51:09.121 Type: SSH_FXP_ATTRS, Size: 37, Number: 263
. 2020-12-08 13:51:09.121 xxx.xxx;-;30776595278;2020-12-04T11:07:14.000Z;"" [200];"" [100];rw-------;0
. 2020-12-08 13:51:09.121 Copying 1 files/directories to local directory "C:\H2H\MMSD"
. 2020-12-08 13:51:09.121 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: Y (102400); CalcS: No; Mask:
. 2020-12-08 13:51:09.121 TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 262144; NewerOnly: No; InclM: ; ResumeL: 0
. 2020-12-08 13:51:09.121 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2020-12-08 13:51:09.121 File: '/xx/xxx.xxx' [2020-12-04T11:07:14.000Z] [30776595278]
. 2020-12-08 13:51:09.122 Copying "/xx/xxx.xxx" to local directory started.
. 2020-12-08 13:51:09.122 Binary transfer mode selected.
. 2020-12-08 13:51:09.123 Checking existence of partially transfered file.
. 2020-12-08 13:51:09.123 Partially transfered file exists.
. 2020-12-08 13:51:09.123 Resuming file transfer.
. 2020-12-08 13:51:09.124 Opening remote file.
> 2020-12-08 13:51:09.124 Type: SSH_FXP_OPEN, Size: 57, Number: 515
< 2020-12-08 13:51:10.570 Type: SSH_FXP_HANDLE, Size: 10, Number: 515
> 2020-12-08 13:51:10.571 Type: SSH_FXP_FSTAT, Size: 10, Number: 776
< 2020-12-08 13:51:11.353 Type: SSH_FXP_ATTRS, Size: 37, Number: 776
> 2020-12-08 13:51:11.353 Type: SSH_FXP_READ, Size: 22, Number: 1029
. 2020-12-08 13:53:18.497 Received disconnect message (by application)
. 2020-12-08 13:53:18.497 Disconnection message text: Idle connection
. 2020-12-08 13:53:18.497 Server sent disconnect message
. 2020-12-08 13:53:18.497 type 11 (by application):
. 2020-12-08 13:53:18.497 "Idle connection"
. 2020-12-08 13:53:18.498 Connection was lost, asking what to do.
. 2020-12-08 13:53:18.498 Asking user:
. 2020-12-08 13:53:18.498 Server sent disconnect message
. 2020-12-08 13:53:18.498 type 11 (by application):
. 2020-12-08 13:53:18.498 "Idle connection" ()
< 2020-12-08 13:53:18.498 Script: Server sent disconnect message
< 2020-12-08 13:53:18.498 type 11 (by application):
< 2020-12-08 13:53:18.498 "Idle connection"’

As you are using some uncommon SFTP server, I guess the problem is that it does not support transfers that do not start at the beginning of the file.

Related

How to use the DBus system in a container with docker root-less

I would like to use DBus in a container with docker in root-less mode.
I use Ubuntu 22.10 :
host$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.10
Release: 22.10
Codename: kinetic
and docker root-less :
host$ docker info
Client:
Context: rootless
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
compose: Docker Compose (Docker Inc., v2.12.2)
scan: Docker Scan (Docker Inc., v0.21.0)
Server:
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 3
Server Version: 20.10.21
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: false
userxattr: true
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: d986545181c905378b0f90faa9c5eae3cbfa3755
runc version: v1.1.4-0-g5fd4c4d
init version: de40ad0
Security Options:
seccomp
Profile: default
rootless
cgroupns
Kernel Version: 5.19.0-26-generic
Operating System: Ubuntu 22.10
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 31.23GiB
Name: ****************
ID: LAEG:NBQE:RME5:OPHR:TT4C:PHA3:25FE:7DPW:46PD:E2VI:6FB6:HQ2P
Docker Root Dir: /home/*******/.local/share/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
I tried to create a container with the dbus socket mounted in it :
docker run -it --rm -v /var/run/dbus:/var/run/dbus ubuntu:latest bash
In my case I need to launch the container with a user different from root. Then I created a test user with the uid 1000:
root#163974703e4c:/# adduser test
Adding user `test' ...
Adding new group `test' (1000) ...
Adding new user `test' (1000) with group `test' ...
Creating home directory `/home/test' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for test
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] Y
I switch to this new user :
root#163974703e4c:/# su test
test#163974703e4c:/$ id
uid=1000(test) gid=1000(test) groups=1000(test)
As I have a user other than root, he has on my host a subuid. My /etc/subuid:
user:100000:65536
Therefore I put an acl on my dbus socket to allow my sub user to use the socket:
host$ sudo setfacl -R -m u:100999:rwx /run/dbus/system_bus_socket
So I have the DBus socket with an access to this socket in the container:
test#163974703e4c:/$ ls -lan /run/dbus/system_bus_socket
srw-rwxrw-+ 1 65534 65534 0 Dec 9 17:46 /run/dbus/system_bus_socket
test#163974703e4c:/$ getfacl /run/dbus/system_bus_socket
getfacl: Removing leading '/' from absolute path names
# file: run/dbus/system_bus_socket
# owner: nobody
# group: nogroup
user::rw-
user:test:rwx
group::rw-
mask::rwx
other::rw-
I test the command dbus-monitor --system but I have this output :
$ dbus-monitor --system
Failed to open connection to system bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
Can you help me please?
I tried to launch my container in privileged mode, with --add-cap ALL, but I still get this error message.
I tried to use strace to show all system call nothing more information :
prctl(PR_CAPBSET_READ, CAP_MAC_OVERRIDE) = 0
prctl(PR_CAPBSET_READ, 0x30 /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, CAP_CHECKPOINT_RESTORE) = 0
prctl(PR_CAPBSET_READ, 0x2c /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, 0x2a /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, 0x29 /* CAP_??? */) = -1 EINVAL (Invalid argument)
getresuid([1000], [1000], [1000]) = 0
getresgid([1000], [1000], [1000]) = 0
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/run/dbus/system_bus_socket"}, 29) = 0
fcntl(3, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
geteuid() = 1000
getsockname(3, {sa_family=AF_UNIX}, [128 => 2]) = 0
poll([{fd=3, events=POLLOUT}], 1, 0) = 1 ([{fd=3, revents=POLLOUT}])
sendto(3, "\0", 1, MSG_NOSIGNAL, NULL, 0) = 1
sendto(3, "AUTH EXTERNAL 31303030\r\n", 24, MSG_NOSIGNAL, NULL, 0) = 24
poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
read(3, "REJECTED EXTERNAL\r\n", 2048) = 19
close(3) = 0
write(2, "Failed to open connection to sys"..., 252Failed to open connection to system bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
) = 252
exit_group(1) = ?
+++ exited with 1 +++
I want to get the same output as on my host in my container :
dbus-monitor --system
dbus-monitor: unable to enable new-style monitoring: org.freedesktop.DBus.Error.AccessDenied: "Rejected send message, 1 matched rules; type="method_call", sender=":1.544" (uid=1000 pid=32723 comm="dbus-monitor --system" label="unconfined") interface="org.freedesktop.DBus.Monitoring" member="BecomeMonitor" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)". Falling back to eavesdropping.
signal time=1670624207.443897 sender=org.freedesktop.DBus -> destination=:1.544 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
string ":1.544"
signal time=1670624214.344658 sender=:1.12 -> destination=(null destination) serial=47 path=/org/freedesktop/UDisks2/drives/ST2000DM008_2FR102_ZFL3HVF7; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
string "org.freedesktop.UDisks2.Drive.Ata"
array [
dict entry(
string "SmartUpdated"
variant uint64 1670624214
)
]
array [
]
The issue is the EXTERNAL authentication used by libdbus which leads t0 discrepancy crossing user-namespace boundaries. Described here https://bugreports.qt.io/browse/QTBUG-108408.
If you can afford to patch libdbus in your project or at least in your containers then you should be good to go by this patch.
From 0d18f455194924ffb100bc980239082187b48301 Mon Sep 1
7 00:00:00 2001
From: =?UTF-8?q?=F0=9F=98=8
Date: Sun, 13 Nov 2022 20:08:02 +0100
Subject: [PATCH] fix: Do not send UID by External Auth
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
sending the UID per EXTERNAL authentication crossing user-namespace would cause
mismatch with out-of-band credentials acquired over UDS
An empty "AUTH EXTERNAL" is still a valid implementation of EXTERNAL authentication
Upstream-ticket: https://gitlab.freedesktop.org/dbus/dbus/-/issues/195
---
dbus/dbus-auth.c | 37 ++++++++++++++-----------------------
1 file changed, 14 insertions(+), 23 deletions(-)
diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c
index d4faa737..1d8f3b53 100644
--- a/dbus/dbus-auth.c
+++ b/dbus/dbus-auth.c
## -1231,31 +1231,22 ## static dbus_bool_t
handle_client_initial_response_external_mech (DBusAuth *auth,
DBusString *response)
{
- /* We always append our UID as an initial response, so the server
- * doesn't have to send back an empty challenge to check whether we
- * want to specify an identity. i.e. this avoids a round trip that
- * the spec for the EXTERNAL mechanism otherwise requires.
- */
- DBusString plaintext;
-
- if (!_dbus_string_init (&plaintext))
+ /* We don't send the UID as crossing user-namespace would cause
+ mismatch with out-of-band credentials acquired over UDS
+ it is still a valid implementation of EXTERNAL authentication
+ check related tickets in sd-bus
+ https://github.com/systemd/systemd/commit/1ed4723d38cd0d1423c8fe650f90fa86007ddf55
+ and gdbus
+ https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2832
+
+ Upstream ticket for proper fix: https://gitlab.freedesktop.org/dbus/dbus/-/issues/195
+ */
+ if (!_dbus_string_append (response,
+ "\r\nDATA"))
+ {
return FALSE;
-
- if (!_dbus_append_user_from_current_process (&plaintext))
- goto failed;
-
- if (!_dbus_string_hex_encode (&plaintext, 0,
- response,
- _dbus_string_get_length (response)))
- goto failed;
-
- _dbus_string_free (&plaintext);
-
+ }
return TRUE;
-
- failed:
- _dbus_string_free (&plaintext);
- return FALSE;
}
static dbus_bool_t
--
2.38.1

Hyperledger fabric facing difficult setting up intermediate CA

I am trying to create intermediate CA for my project, I have one root CA and one intermediate CA with Intermediate CA config file as shown below. I am facing issue to create keypairs/MSP and tls cert for intermediate CA & unable to pass the config file to intermediate CA. Steps I followed
Running the Root CA container with bootstrapping admin.
Enrol the admin which generate the MSP for CA admin for org1
fabric-ca-client enroll -u https://admin:adminpw#localhost:7054 --caname ca-org1 --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem
Register the Intermediate CA to root CA using below command
fabric-ca-client register --caname ca-org1 --id.name ica --id.attrs '"hf.Registrar.Roles=user,peer",hf.Revoker=true,hf.IntermediateCA=true' --id.secret icapw --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem
Run the Intermediate CA container as shown below with using the below config file.
Enrol the Intermediate CA
fabric-ca-client enroll -u https://icaadmin:icaadminpw#localhost:6054 --caname ica-org1 --tls.certfiles ${PWD}/organizations/fabric-ca/icaOrg1/tls-cert.pem
Root CA
version: "2"
networks:
test:
services:
ca_org1:
image: hyperledger/fabric-ca:$IMAGE_TAG
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org1
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_PORT=7054
ports:
- "7054:7054"
command: sh -c 'fabric-ca-server start -b admin:adminpw -d'
volumes:
- ../organizations/fabric-ca/org1:/etc/hyperledger/fabric-ca-server
container_name: ca_org1
networks:
- test
Intermidate CA
version: "2"
networks:
test:
services:
ica-org1:
image: hyperledger/fabric-ca
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ica-org1
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_LOGGING_SPEC=debug
- FABRIC_CA_SERVER_PORT=6054
ports:
- "6054:6054"
command: sh -c 'fabric-ca-server start -b icaadmin:icaadminpw -u -d http://ica:icapw#ca-org1:7054'
volumes:
- ../organizations/fabric-ca/icaOrg1:/etc/hyperledger/fabric-ca-server
container_name: ica-org1
networks:
- test
ICA Fabric Config file
# Version of config file
version: 1.2.0
# Server's listening port (default: 7054)
port: 7054
# Enables debug logging (default: false)
debug: false
# Size limit of an acceptable CRL in bytes (default: 512000)
crlsizelimit: 512000
tls:
# Enable TLS (default: false)
enabled: true
# TLS for the server's listening port
certfile:
keyfile:
clientauth:
type: noclientcert
certfiles:
ca:
# Name of this CA
name: ica.org1.example.com
# Key file (is only used to import a private key into BCCSP)
keyfile:
# Certificate file (default: ca-cert.pem)
certfile:
# Chain file
chainfile:
crl:
# Specifies expiration for the generated CRL. The number of hours
# specified by this property is added to the UTC time, the resulting time
# is used to set the 'Next Update' date of the CRL.
expiry: 24h
registry:
# Maximum number of times a password/secret can be reused for enrollment
# (default: -1, which means there is no limit)
maxenrollments: -1
# Contains identity information which is used when LDAP is disabled
identities:
- name: icaadmin
pass: icaadminpw
type: client
affiliation: ""
attrs:
hf.Registrar.Roles: "client,peer,user,member"
hf.Registrar.DelegateRoles: "client,peer,user,member"
hf.Revoker: true
hf.IntermediateCA: true
hf.GenCRL: true
hf.Registrar.Attributes: "*"
hf.AffiliationMgr: true
db:
type: sqlite3
datasource: fabric-ca-server.db
tls:
enabled: false
certfiles:
client:
certfile:
keyfile:
ldap:
# Enables or disables the LDAP client (default: false)
# If this is set to true, the "registry" section is ignored.
enabled: false
# The URL of the LDAP server
url: ldap://<adminDN>:<adminPassword>#<host>:<port>/<base>
# TLS configuration for the client connection to the LDAP server
tls:
certfiles:
client:
certfile:
keyfile:
# Attribute related configuration for mapping from LDAP entries to Fabric CA attributes
attribute:
names: ["uid", "member"]
converters:
- name:
value:
maps:
groups:
- name:
value:
affiliations:
org1:
- department1
- department2
signing:
default:
usage:
- digital signature
expiry: 8760h
profiles:
ca:
usage:
- cert sign
- crl sign
expiry: 43800h
caconstraint:
isca: true
maxpathlen: 0
tls:
usage:
- signing
- key encipherment
- server auth
- client auth
- key agreement
expiry: 8760h
csr:
cn: ica.org1.example.com
names:
- C: US
ST: "North Carolina"
L: "Durham"
O: org1.example.com
OU:
hosts:
- localhost
- org1.example.com
ca:
expiry: 131400h
pathlength: 1
#############################################################################
# BCCSP (BlockChain Crypto Service Provider) section is used to select which
# crypto library implementation to use
#############################################################################
bccsp:
default: SW
sw:
hash: SHA2
security: 256
filekeystore:
# The directory used for the software file-based keystore
keystore: msp/keystore
cacount:
cafiles:
intermediate:
parentserver:
url: https://ca-org1:7054
caname: ca.org1.example.com
enrollment:
hosts: localhost
profile:
label:
tls:
certfiles:
client:
certfile:
keyfile:
Since you configured your CAs as TLS enabled, root TLS certificate must be used by intermediate CA. Check your intermediate CA file's corresponding section.
The certfiles attribute's value /tmp/root-ca-cert.pem is the same file of root CA's file: /tmp/hyperledger/fabric-ca/crypto/ca-cert.pem
intermediate:
parentserver:
url: https://admin:admin#root.ca.example.com:7054
caname: root.ca.example.com
enrollment:
hosts:
- ca1.example.com
profile: ca
label:
tls:
certfiles:
- /tmp/root-ca-cert.pem
client:
certfile:
keyfile:

How to sign .jar file using token (got from softhsm using pkcs11) by jarsigner?

I am running softhsm in Windows OS.I am getting token info using pkcs11js npm package.I want to know how i can use the token to sign my .jar file in nodejs?
Token info getting from softhsm using pkcs11js
'SoftHSM slot ID 0x2d88f571',
manufacturerID: 'SoftHSM project',
flags: 1,
hardwareVersion: {
major: 2,
minor: 5
},
firmwareVersion: {
major: 2,
minor: 5
}
}
token_info-- -- -- -- -- -- -- -- -- -- -- -- -- - > {
label: 'My token 2 ',
manufacturerID: 'SoftHSM project ',
model: 'SoftHSM v2 ',
serialNumber: 'ffbf344dad88f571',
flags: 1069,
maxSessionCount: 0,
sessionCount: 4294967295

Error - "Too many intermediates for path length constraint" when register new identity

In hyperledger fabric-ca, I create chain of CAs like:
Root CA - Intermediate CA 1 - Intermediate CA 2 - Intermediate CA 3
With these CAs, in "signing" part of fabric-ca-config.yaml file I set "maxpathlen:5", and in "csr" part I set "pathlength:5"
It's mean my chain is valid for at least 4 Intermediate CA and I can register new identity in Intermediate CA 3.
In fact, I can enroll admin of Intermediate CA 3, however, when I register new identity, I have this error:
/register 401 26 "Untrusted certificate: Failed to verify certificate: x509: too many intermediates for path length constraint"
What wrong I have done, and how to config this value
My config file
# Version of config file
version: 1.1.0
# Server's listening port (default: 7054)
port: 7054
# Enables debug logging (default: false)
debug: false
# Size limit of an acceptable CRL in bytes (default: 512000)
crlsizelimit: 512000
tls:
# Enable TLS (default: false)
enabled: false
# TLS for the server's listening port
certfile:
keyfile:
clientauth:
type: noclientcert
certfiles:
ca:
# Name of this CA
name:
# Key file (is only used to import a private key into BCCSP)
keyfile:
# Certificate file (default: ca-cert.pem)
certfile:
# Chain file
chainfile:
crl:
# Specifies expiration for the generated CRL. The number of hours
# specified by this property is added to the UTC time, the resulting time
# is used to set the 'Next Update' date of the CRL.
expiry: 24h
registry:
# Maximum number of times a password/secret can be reused for enrollment
# (default: -1, which means there is no limit)
maxenrollments: -1
# Contains identity information which is used when LDAP is disabled
identities:
- name: Admin
pass: adminpw
type: client
affiliation:
attrs:
hf.Registrar.Roles: "*"
hf.Registrar.DelegateRoles: "*"
hf.Revoker: true
hf.IntermediateCA: true
hf.GenCRL: true
hf.Registrar.Attributes: "*"
hf.AffiliationMgr: true
affiliations:
org1:
- department1
- department2
org2:
- department1
signing:
default:
usage:
- digital signature
expiry: 8760h
profiles:
ca:
usage:
- cert sign
- crl sign
expiry: 43800h
caconstraint:
isca: true
maxpathlen: 5
tls:
usage:
- signing
- key encipherment
- server auth
- client auth
- key agreement
expiry: 8760h
csr:
cn: fabric-ca-server
names:
- C: US
ST: "California"
L:
O: Hyperledger
OU: Fabric
hosts:
- ca
- localhost
ca:
expiry: 131400h
pathlength: 5
I found the root cause is simple because when initialize network, I don't create cert/key by myself and config it so that Fabric-CA use itself key/cert which config default set maxpathlen=1.
If I create cert/key by myself and in cert config pathlength > 3 then my network will be ok.

Using Go's crypto/ssh to run commands on a cisco switch

I'm trying to run commands over ssh on a cisco switch and print the result to the console. I have successfully done this with a debian linux server. On the cisco switch however the execution of the command blocks the main function and it never finishes.
package main
import (
"bytes"
"fmt"
"golang.org/x/crypto/ssh"
)
func main(){
// Client configuration
config := &ssh.ClientConfig{
User: "admin",
Auth: []ssh.AuthMethod{
ssh.Password("mypassword"),
},
}
//Connection
fmt.Println("Connecting...")
client, err := ssh.Dial("tcp", "10.0.0.1:22", config)
if err != nil {
panic("Failed to dial: " + err.Error())
}
fmt.Println("Connected...")
//Session
fmt.Println("Creating Session...")
session, err := client.NewSession()
if err != nil {
panic("Failed to create session: " + err.Error())
}
fmt.Println("Session created...")
defer session.Close()
// Execute a single command
var b bytes.Buffer
session.Stdout = &b
fmt.Println("Running command...")
if err := session.Run("show environment all"); err != nil {
panic("Failed to run: " + err.Error())
}
fmt.Println("Command run: Output:", b.String())
}
Return (hangs at session.Run() ) :
Connecting...
Connected...
Creating Session...
Session created...
Running command...
I am fishing in the dark at the moment. Any help is appreciated!
Thank you!
Edit:
I know that my program hangs exactly here:
if err := <-s.errors; err != nil && copyError == nil {
copyError = err
}
within the Wait() function of Go's x/crypto/ssh package (session.go). I am however not sure why. Seems like at this point we are waiting to get an error from the sessions errors-channel. But at this point my go skills leave me hanging...
Edit 2:
When I run my code, my CISCO switch tells me the following in the log.
SWU-ACS-02#26-May-2015 19:07:50 %AAA-I-CONNECT: User CLI session for user admin over ssh , source 10.0.0.2 destination 10.0.0.1 ACCEPTED, aggregated (1)
26-May-2015 19:08:09 %AAA-I-CONNECT: User CLI session for user admin over ssh , source 10.0.0.2 destination 10.0.0.1 ACCEPTED
Edit 3:
This is the output of ssh with the most verbose option (-vvv)
admin#10.0.0.1's password:
debug3: packet_send2: adding 48 (len 61 padlen 19 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
Authenticated to 10.0.0.1 ([10.0.0.1]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting no-more-sessions#openssh.com
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug2: fd 3 setting TCP_NODELAY
debug3: packet_set_tos: set IP_TOS 0x08
debug1: Sending environment.
debug3: Ignored env TERM
debug3: Ignored env SHELL
debug3: Ignored env XDG_SESSION_COOKIE
debug3: Ignored env SSH_CLIENT
debug3: Ignored env SSH_TTY
debug3: Ignored env USER
debug3: Ignored env LS_COLORS
debug3: Ignored env MAIL
debug3: Ignored env PATH
debug3: Ignored env PWD
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: Ignored env SHLVL
debug3: Ignored env HOME
debug3: Ignored env LANGUAGE
debug3: Ignored env LS_OPTIONS
debug3: Ignored env LOGNAME
debug3: Ignored env SSH_CONNECTION
debug3: Ignored env _
debug1: Sending command: show environment all
debug2: channel 0: request exec confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 256 rmax 128
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0

Resources