Skip to content

Commit

Permalink
Adding HTTPS on server with self signed certificate.
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyolazabal committed Nov 14, 2023
1 parent dadf71d commit c62996b
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 86 deletions.
Binary file modified .DS_Store
Binary file not shown.
22 changes: 22 additions & 0 deletions certificates/server.cert
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDnzCCAoegAwIBAgIUX71x+OYXMyeabfKiwk9q+OtCJjowDQYJKoZIhvcNAQEL
BQAwXzELMAkGA1UEBhMCRlIxDTALBgNVBAgMBE5vbmUxDTALBgNVBAcMBE5vbmUx
DzANBgNVBAoMBkhpdmVNUTEMMAoGA1UECwwDTGFiMRMwEQYDVQQDDAplc2UtZWRp
dG9yMB4XDTIzMTAwNDA5MTcwMloXDTIzMTEwMzA5MTcwMlowXzELMAkGA1UEBhMC
RlIxDTALBgNVBAgMBE5vbmUxDTALBgNVBAcMBE5vbmUxDzANBgNVBAoMBkhpdmVN
UTEMMAoGA1UECwwDTGFiMRMwEQYDVQQDDAplc2UtZWRpdG9yMIIBIjANBgkqhkiG
9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1F1TSbtaiX3QbhQTJYO+gQQCvx72pHV+fhA1
UnwWZ4IXH4ucCslixiWAq/GrK4Arr6Rl6cX+RA+JbWDCJQlCShNd1mW6Yt2nVwMM
Y6q79qf3NJNnaNd9aTu8odOgbNRT8d8lst+Zkmvb7TT8/bCP4A4r5mNNdKrhovEo
ipIPeykoWEhAhAVxCzHCY74wBwPQx0XBoruQfgZLaYMrKKqXsitRrs5dxdSd7uJN
p7H547IVbvIHivo2GGzuPqI2D0UkPABnwYsoqb77p59S315B4Q7cSzcD2cf/KYPx
zGjor2j6RO9+Rznrq1OSAh/FagUZpuHaE1Fb3ZgsGQnxtURyVQIDAQABo1MwUTAd
BgNVHQ4EFgQULI0HtTqBgIFbHZQkq8Po1qxY2BUwHwYDVR0jBBgwFoAULI0HtTqB
gIFbHZQkq8Po1qxY2BUwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC
AQEAnfCLKQLalsqxwfN9qhJO5wtTqO0X5igIFHNMH65EtoxyvR+62YtF4S+yBmLl
vaogXENoYvZBPu4omUC1Gh6udr6sB6CJYGBs5R5lo2JgtrrYXhkNot85XBDrzyCB
lSBP3Bw7jl/IRGDh5gnDeBBJPpAEizGpcFAEg9+Nb148JtEj+Fcp37OVe6TkDuMG
29iU4saiZOXtoOmH1Rdkl2SDHJ7flRJKUwhbzs5z8QgBWFOl3XHZox4636HLw1yo
h9dKZcWzPfRM4+piAHgfv2qL9mjGhxc4G3IOnuj8TwxOMFR3SgbGls8lda3SB2px
DjyWS5AuDmOm9szwOfUicjXyZg==
-----END CERTIFICATE-----
28 changes: 28 additions & 0 deletions certificates/server.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDUXVNJu1qJfdBu
FBMlg76BBAK/HvakdX5+EDVSfBZnghcfi5wKyWLGJYCr8asrgCuvpGXpxf5ED4lt
YMIlCUJKE13WZbpi3adXAwxjqrv2p/c0k2do131pO7yh06Bs1FPx3yWy35mSa9vt
NPz9sI/gDivmY010quGi8SiKkg97KShYSECEBXELMcJjvjAHA9DHRcGiu5B+Bktp
gysoqpeyK1Guzl3F1J3u4k2nsfnjshVu8geK+jYYbO4+ojYPRSQ8AGfBiyipvvun
n1LfXkHhDtxLNwPZx/8pg/HMaOivaPpE735HOeurU5ICH8VqBRmm4doTUVvdmCwZ
CfG1RHJVAgMBAAECggEALaSkWNHPlwMHWA1xAwxiltyrkXPge370Ubh+mWyprRQZ
D7LkNi5MED3xvqMJ0ObynMTnEZx4Np0nQq6785Venci1T7YcHhE5XPp/AHHrBcva
lj6DSJWeMw6/j4GKdrGZHECDnAMygPW1NnG/2W/IMJYj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-----END PRIVATE KEY-----
161 changes: 76 additions & 85 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -3,226 +3,217 @@ generator client {
}

datasource db {
provider = "mysql"
provider = "postgresql"
url = env("DATABASE_URL")
}

model cc_permissions {
id Int @id @unique(map: "id") @default(autoincrement())
permission_string String @db.Text
description String? @db.Text
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
id Int @id @default(autoincrement())
permission_string String
description String?
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
cc_role_permissions cc_role_permissions[]
cc_user_permissions cc_user_permissions[]
}

model cc_role_permissions {
role Int
permission Int
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
cc_permissions cc_permissions @relation(fields: [permission], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "cc_role_permissions_permissions_id_fk")
cc_roles cc_roles @relation(fields: [role], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "cc_role_permissions_roles_id_fk")
@@id([role, permission])
@@index([permission], map: "cc_role_permissions_permissions_id_fk")
@@id([role, permission], map: "cc_role_permissions_role_permission_pk")
}

model cc_roles {
id Int @id @unique(map: "id") @default(autoincrement())
name String @unique(map: "name") @db.VarChar(762)
description String? @db.Text
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
id Int @id @unique(map: "cc_roles_id_uindex") @default(autoincrement())
name String @unique(map: "cc_roles_name_uindex")
description String?
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
cc_role_permissions cc_role_permissions[]
cc_user_roles cc_user_roles[]
}

model cc_user_permissions {
user_id Int
permission Int
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
cc_permissions cc_permissions @relation(fields: [permission], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "cc_user_permissions_permissions_id_fk")
cc_users cc_users @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "cc_user_permissions_users_id_fk")
@@id([user_id, permission])
@@index([permission], map: "cc_user_permissions_permissions_id_fk")
@@id([user_id, permission], map: "cc_user_permissions_user_permission_pk")
}

model cc_user_roles {
user_id Int
role_id Int
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
cc_roles cc_roles @relation(fields: [role_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "cc_user_roles_roles_id_fk")
cc_users cc_users @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "cc_user_roles_users_id_fk")
@@id([user_id, role_id])
@@index([role_id], map: "cc_user_roles_roles_id_fk")
@@id([user_id, role_id], map: "cc_user_roles_user_role_pk")
}

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model cc_users {
id Int @id @unique(map: "cc_users_id_uindex") @default(autoincrement())
username String @unique(map: "cc_users_username_uindex") @db.VarChar(762)
password String? @db.Text
username String @unique(map: "cc_users_username_uindex")
password String?
password_iterations Int
password_salt String @db.Text
password_salt String
algorithm String @db.VarChar(32)
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
cc_user_permissions cc_user_permissions[]
cc_user_roles cc_user_roles[]
}

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model permissions {
id Int @id @unique(map: "id") @default(autoincrement())
topic String @db.Text
id Int @id @default(autoincrement())
topic String
publish_allowed Boolean @default(false)
subscribe_allowed Boolean @default(false)
qos_0_allowed Boolean @default(false)
qos_1_allowed Boolean @default(false)
qos_2_allowed Boolean @default(false)
retained_msgs_allowed Boolean @default(false)
shared_sub_allowed Boolean @default(false)
shared_group String? @db.Text
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
shared_group String?
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
role_permissions role_permissions[]
user_permissions user_permissions[]
@@index([topic(length: 767)], map: "permissions_topic_index")
@@index([topic], map: "permissions_topic_index")
}

model rest_api_permissions {
id Int @id @unique(map: "id") @default(autoincrement())
permission_string String @db.Text
description String? @db.Text
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
id Int @id @default(autoincrement())
permission_string String
description String?
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
rest_api_role_permissions rest_api_role_permissions[]
rest_api_user_permissions rest_api_user_permissions[]
}

model rest_api_role_permissions {
role Int
permission Int
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
rest_api_permissions rest_api_permissions @relation(fields: [permission], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "rest_api_role_permissions_permissions_id_fk")
rest_api_roles rest_api_roles @relation(fields: [role], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "rest_api_role_permissions_roles_id_fk")
@@id([role, permission])
@@index([permission], map: "rest_api_role_permissions_permissions_id_fk")
@@id([role, permission], map: "rest_api_role_permissions_role_permission_pk")
}

model rest_api_roles {
id Int @id @unique(map: "id") @default(autoincrement())
name String @unique(map: "name") @db.VarChar(762)
description String? @db.Text
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
id Int @id @unique(map: "rest_api_roles_id_uindex") @default(autoincrement())
name String @unique(map: "rest_api_roles_name_uindex")
description String?
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
rest_api_role_permissions rest_api_role_permissions[]
rest_api_user_roles rest_api_user_roles[]
}

model rest_api_user_permissions {
user_id Int
permission Int
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
rest_api_permissions rest_api_permissions @relation(fields: [permission], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "rest_api_user_permissions_permissions_id_fk")
rest_api_users rest_api_users @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "rest_api_user_permissions_users_id_fk")
@@id([user_id, permission])
@@index([permission], map: "rest_api_user_permissions_permissions_id_fk")
@@id([user_id, permission], map: "rest_api_user_permissions_user_permission_pk")
}

model rest_api_user_roles {
user_id Int
role_id Int
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
rest_api_roles rest_api_roles @relation(fields: [role_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "rest_api_user_roles_roles_id_fk")
rest_api_users rest_api_users @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "rest_api_user_roles_users_id_fk")
@@id([user_id, role_id])
@@index([role_id], map: "rest_api_user_roles_roles_id_fk")
@@id([user_id, role_id], map: "rest_api_user_roles_user_role_pk")
}

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model rest_api_users {
id Int @id @unique(map: "id") @default(autoincrement())
username String @unique(map: "rest_api_users_username_uindex") @db.VarChar(762)
password String? @db.Text
id Int @id @unique(map: "rest_api_users_id_uindex") @default(autoincrement())
username String @unique(map: "rest_api_users_username_uindex")
password String?
password_iterations Int
password_salt String @db.Text
password_salt String
algorithm String @db.VarChar(32)
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
rest_api_user_permissions rest_api_user_permissions[]
rest_api_user_roles rest_api_user_roles[]
}

model role_permissions {
role Int
permission Int
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
permissions permissions @relation(fields: [permission], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "role_permissions_permissions_id_fk")
roles roles @relation(fields: [role], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "role_permissions_roles_id_fk")
@@id([role, permission])
@@index([permission], map: "role_permissions_permissions_id_fk")
@@id([role, permission], map: "role_permissions_role_permission_pk")
}

model roles {
id Int @id @unique(map: "cc_roles_id_uindex") @default(autoincrement())
name String @unique(map: "cc_roles_name_uindex") @db.VarChar(762)
description String? @db.Text
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
id Int @id @unique(map: "roles_id_uindex") @default(autoincrement())
name String @unique(map: "roles_name_uindex")
description String?
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
role_permissions role_permissions[]
user_roles user_roles[]
}

model user_permissions {
user_id Int
permission Int
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
permissions permissions @relation(fields: [permission], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "user_permissions_permissions_id_fk")
users users @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "user_permissions_users_id_fk")
@@id([user_id, permission])
@@index([permission], map: "user_permissions_permissions_id_fk")
@@id([user_id, permission], map: "user_permissions_user_permission_pk")
}

model user_roles {
user_id Int
role_id Int
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
roles roles @relation(fields: [role_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "user_roles_roles_id_fk")
users users @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "user_roles_users_id_fk")
@@id([user_id, role_id])
@@index([role_id], map: "user_roles_roles_id_fk")
@@id([user_id, role_id], map: "user_roles_user_role_pk")
}

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model users {
id Int @id @unique(map: "id") @default(autoincrement())
username String @unique(map: "username") @db.VarChar(762)
password String? @db.Text
id Int @id @unique(map: "users_id_uindex") @default(autoincrement())
username String @unique(map: "users_username_uindex")
password String?
password_iterations Int
password_salt String @db.Text
password_salt String
algorithm String @db.VarChar(32)
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @db.Timestamp(0)
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
user_permissions user_permissions[]
user_roles user_roles[]
}
Loading

0 comments on commit c62996b

Please sign in to comment.