Created
January 19, 2026 19:31
-
-
Save tiebingzhang/2811d1366846d874ade2a91745675c34 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # AS2 Send Script | |
| # Sends encrypted AS2 message to server | |
| # SET SERVER_URL to your AS2 server, and set your AS2_FROM and AS2_TO and MESSAGE_ID | |
| SERVER_URL="http://a.b.c.d:5080" | |
| AS2_FROM="PARTNER-COMPANY" | |
| AS2_TO="MYCORP" | |
| MESSAGE_ID="<$(uuidgen | tr '[:upper:]' '[:lower:]')@$(hostname)>" | |
| echo "Sending AS2 message to $SERVER_URL" | |
| curl -X POST "$SERVER_URL" \ | |
| -H "Date: $(date -u '+%a, %d %b %Y %H:%M:%S GMT')" \ | |
| -H "From: partner@company.com" \ | |
| -H "Subject: AS2 message from $AS2_FROM" \ | |
| -H "Mime-Version: 1.0" \ | |
| -H "Content-Type: application/pkcs7-mime; smime-type=enveloped-data; name=smime.p7m" \ | |
| -H "Content-Transfer-Encoding: binary" \ | |
| -H "Content-Disposition: attachment; filename=smime.p7m" \ | |
| -H "Disposition-Notification-To: partner@company.com" \ | |
| -H "Disposition-Notification-Options: signed-receipt-protocol=required, pkcs7-signature; signed-receipt-micalg=required,sha256" \ | |
| -H "AS2-From: $AS2_FROM" \ | |
| -H "AS2-To: $AS2_TO" \ | |
| -H "AS2-Version: 1.1" \ | |
| -H "Message-ID: $MESSAGE_ID" \ | |
| -H "Connection: close" \ | |
| --data-binary @newfile.encrypted.bin \ | |
| -v | |
| echo "AS2 message sent with Message-ID: $MESSAGE_ID" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment