Trouble Establishing a Secure Connection to Minio running in Docker on Pi 4

32 Views Asked by At

I have a Raspberry Pi 4 running a minio docker container, but cannot connect with python from my PC unless I set secure = False Using the example they provide here https://min.io/docs/minio/linux/developers/python/minio-py.html

from minio import Minio
from minio.error import S3Error

def main():
    client = Minio("pi4",
    access_key="CAVZvFX5pM4lsRrIk8RA",
    secret_key="QScJoMK2CbhZQvBxfRyeANgY9myq7zIpnJlWnQAY")

    source_file = "images.jpeg"

    bucket_name = "python-test-bucket"
    destination_file = "penguin.jpeg"

    found = client.bucket_exists(bucket_name)

    if not found:
        client.make_bucket(bucket_name)
        print("Created bucket", bucket_name)
    else:
        print("Bucket", bucket_name, "already exists")

    client.fput_object(
    bucket_name, destination_file, source_file,
    )
    print(
    source_file, "successfully uploaded as object",
    destination_file, "to bucket", bucket_name,
    )
if __name__ == "__main__":
    try:
        main()
    except S3Error as exc:
        print("error occurred.", exc)

I can get to pi4:9001 in a web browser and generate the access token and key

I tried downloading mkcert and then running

mkcert -install
mkcert minio

and then made a CAs directory with the minio.pem file and a certs directory containing minio-key.pem and minio.pem

then ran

docker run -p 9000:9000 -p 9001:9001 --name minio -v ~/data:/data -v ./CAs:/root/certs/CAs -v ./certs:/root/certs -e "MINIO_ROOT_USER=ROOTNAME" -e "MINIO_ROOT_PASSWORD=CHANGEME123" quay.io/minio/minio server /data --console-address ":9001"

But still no luck. When I modify the client portion to be

client = Minio("pi4",
access_key="CAVZvFX5pM4lsRrIk8RA",
secret_key="QScJoMK2CbhZQvBxfRyeANgY9myq7zIpnJlWnQAY",
secure = False)

It does work. Could anyone tell me what I'm doing wrong with the certificate or point me in the right direction? First time trying to use them.

0

There are 0 best solutions below