Package: s3authbasic
Contentss3authbasicAmazon SettingsApplication deploymentConfigurationStart the application0.1.30.1.20.1.10.10.0s3authbasics3authbasic is a Pyramid application aimed to serve a static websites stored
in Amazon S3 protected by Auth Basic authentication. You need a IAM user with
its credentials and read access on the bucket which contains the static
files.Amazon SettingsI assumed that you have a protected bucket. To create the IAM user with the
correct permissions you need go to theIAMapp in the AWS ConsoleClickUserssection and click in theCreare New Userblue button.Enter the username you want. It can’t contains whitespaces. And click oncreateClick onDownload Credentialor write down the credentials info.Now, we need to add the policy to give read access permissions to the user.Click in the created user and go to thepermissionstab below.Click on theAttach User Policy.Click onCustom Policyand in theSelectbutton.Give a policy name, likes3-reader-policy.Copy the follow block in thePolicy Documentbox. Please,
replaceprotected-htmlwith your bucket name.{"Statement":[{"Effect":"Allow","Action":["s3:Get*","s3:ListBucket"],"Resource":["arn:aws:s3:::protected-html","arn:aws:s3:::protected-html/*"]}]}Application deploymentI suggest you to use a virtualenv but I don’t use that in this doc.pipinstalls3authbasicYou need a Pyramid ini settings file. You can find oneexamplein the
github reposity in the config-templates directory.ConfigurationYou can config the app by editing the settings file or by using envionment
variables.If you want to use the file, then the AWS and the user settings are
documented in the file.The AWS environment variables are like this:exportAWS_BUCKET_NAME='bucketname'exportAWS_SECRET_ACCESS_KEY='12312sdf32'exportAES_ACCESS_KEY_ID='123123123aaa'To define users to access the app, the variable should starts withUSER_.
The user name is the word after the underscore character and shoud be defined
in the correct capitalization. This is, if you want a user calledadmin,
you should create the environment variable USER_admin.You can setup many users as you need.The password should be hashed by sha256.You can get the hash of your password by this command in linux:echo-nthepassword|sha256sumThe environment variable should look like this:exportUSER_admin='123123123123123123123'NOTE:In 0.1.3 version we added encoding utf-8 option to password, so if
you want to use non ascii characters, the hash can vary. You can use something
like this in a terminal. You need the hashlib package from pypi.fromhashlibimportsha256sha256('your password!!'.encode('utf-8')).hexdigest()Start the applicationYou should use the follow command if you have customized the ini file:pservedevelopment.iniOtherwise, you can use this command:run-s3authbasicIf you are using the default ini file, the application should be
available in the 6543 port. If you have deployed the app in your
own system, you can access it throughhttp://127.0.0.1:6543/0.1.3Fix UTF8 passwords problems0.1.2Fix path with whitespacesFix settings relative location and the default package location detection0.1.1Fix WebTest errorAdd files needed by heroku0.1The first published version0.0Initial version