tiredofit/docker-openldap

s3 backup error : curl: (3) URL using bad/illegal format or missing URL

patrickstump opened this issue · 2 comments

When using the S3 Backup, receiving the following error:

curl: (3) URL using bad/illegal format or missing URL

Possible Cause

The bucket name is ldap01.localdomain which has a .. When I run curl manually, this works fine, however i wonder if with the escaping it is causing an issue.

Config

The following environmental variables are set in my docker-compose file.

      - ENABLE_BACKUP=TRUE
      - BACKUP_INTERVAL=1440
      - BACKUP_RETENTION=10080
      - BACKUP_COMPRESSION=BZ
      - BACKUP_COMPRESSION_LEVEL
      - BACKUP_TYPE=S3
      - S3_BUCKET='ldap01.localdomain'
      - S3_HOST='s3.localdomain'
      - S3_KEY_ID="ldap01"
      - S3_KEY_SECRET="BIGPASSWORDHERE"
      - S3_PATH='openldap-backup'
      - S3_PROTOCOL='https'
      - S3_URI_STYLE='PATH'

Logs

[DEBUG] /etc/services.available/20-openldap-backup/run ** [openldap-backup] Uploading 20210316-162253_openldap_data.bz2.md5 to S3
+ curl -T /tmp/backups/20210316-162253_openldap_data.bz2.md5 ''\''https'\''://'\''s3.localdomain'\''/'\''ldap01.localdomain-backup'\''/'\''openldap-backup'\''/20210316-162253_openldap_data.bz2.md5' -H 'Date: ' -H 'Authorization: AWS "ldap01":PASSWORd' -H 'Content-Type: application/octet-stream' -H 'Content-MD5: <MD5HASH>'
curl: (3) URL using bad/illegal format or missing URL

Tried removing the . from the bucket name. No effect

      - ENABLE_BACKUP=TRUE
      - BACKUP_INTERVAL=1440
      - BACKUP_RETENTION=10080
      - BACKUP_COMPRESSION=BZ
      - BACKUP_COMPRESSION_LEVEL
      - BACKUP_TYPE=S3
      - S3_BUCKET='ldap01-localdomain'
      - S3_HOST='s3.localdomain'
      - S3_KEY_ID="ldap01"
      - S3_KEY_SECRET="BIGPASSWORDHERE"
      - S3_PATH='openldap-backup'
      - S3_PROTOCOL='https'
      - S3_URI_STYLE='PATH'

Output

[DEBUG] /etc/services.available/20-openldap-backup/run ** [openldap-backup] Uploading 20210324-170638_openldap_config.bz2.md5 to S3

  • curl -T /tmp/backups/20210324-170638_openldap_config.bz2.md5 ''''https'''://'''s3.localdomain'''/'''ldap01-localdomain-backup'''/'''openldap-backup'''/20210324-170638_openldap_config.bz2.md5' -H 'Date: ' -H 'Authorization: AWS "ldap01":BIGPASSWORDHERE=' -H 'Content-Type: application/octet-stream' -H 'Content-MD5: MD5SUMHERE=='
    curl: (3) URL using bad/illegal format or missing URL

Figured it out.
Do NOT put environmental variable in quotes in the docker-compose.yml file.
Bad:

      - S3_BUCKET='ldap01.localdomain'
      - S3_HOST='s3.localdomain'
      - S3_KEY_ID="ldap01"
      - S3_KEY_SECRET="BIGPASSWORDHERE"
      - S3_PATH='openldap-backup'
      - S3_PROTOCOL='https'

Good:

      - S3_BUCKET=ldap01.localdomain
      - S3_HOST=s3.localdomain
      - S3_KEY_ID=ldap01
      - S3_KEY_SECRET=BIGPASSWORDHERE
      - S3_PATH=openldap-backup
      - S3_PROTOCOL=https