Skip to content

Commit 9090f12

Browse files
committed
Merge branch 'movedtde' into tde_move_in
2 parents 572d108 + a422640 commit 9090f12

File tree

294 files changed

+83542
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

294 files changed

+83542
-0
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "contrib/pg_tde/src/libkmip"]
2+
path = contrib/pg_tde/src/libkmip
3+
url = https://github.com/Percona-Lab/libkmip.git

contrib/pg_tde/.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*.so
2+
*.o
3+
*.frontend
4+
__pycache__
5+
6+
/config.cache
7+
/config.log
8+
/config.status
9+
/autom4te.cache
10+
/configure~
11+
t/results
12+
13+
# tools files
14+
typedefs-full.list

contrib/pg_tde/CONTRIBUTING.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Contributing guide
2+
3+
Welcome to `pg_tde` - the Transparent Database Encryption for PostgreSQL!
4+
5+
We're glad that you would like to become a Percona community member and participate in keeping open source open.
6+
7+
You can contribute in one of the following ways:
8+
9+
1. Reach us on our [Forums](https://forums.percona.com/c/postgresql/pg-tde-transparent-data-encryption-tde/82).
10+
2. [Submit a bug report or a feature request](#submit-a-bug-report-or-a-feature-request)
11+
3. [Submit a pull request (PR) with the code patch](#submit-a-pull-request)
12+
4. [Contribute to documentation](#contributing-to-documentation)
13+
14+
By contributing, you agree to the [Percona Community code of conduct](https://github.com/percona/community/blob/main/content/contribute/coc.md).
15+
16+
17+
## Submit a bug report or a feature request
18+
19+
All bug reports, enhancements and feature requests are tracked in [Jira issue tracker](https://jira.percona.com/projects/PG). If you would like to suggest a new feature / an improvement or you found a bug in `pg_tde`, please submit the report to the [PG project](https://jira.percona.com/projects/PG/issues).
20+
21+
Start by searching the open tickets for a similar report. If you find that someone else has already reported your issue, then you can upvote that report to increase its visibility.
22+
23+
If there is no existing report, submit your report following these steps:
24+
25+
1. Sign in to [Jira issue tracker](https://jira.percona.com/projects/PG/issues). You will need to create an account if you do not have one.
26+
2. In the _Summary_, _Description_, _Steps To Reproduce_, _Affects Version_ fields describe the problem you have detected or an idea that you have for a new feature or improvement.
27+
3. As a general rule of thumb, try to create bug reports that are:
28+
29+
* Reproducible: describe the steps to reproduce the problem.
30+
* Unique: check if there already exists a JIRA ticket to describe the problem.
31+
* Scoped to a Single Bug: only report one bug in one JIRA ticket
32+
33+
## Submit a pull request
34+
35+
Though not mandatory, we encourage you to first check for a bug report among Jira issues and in the PR list: perhaps the bug has already been addressed.
36+
37+
For feature requests and enhancements, we do ask you to create a Jira issue, describe your idea and discuss the design with us. This way we align your ideas with our vision for the product development.
38+
39+
If the bug hasn’t been reported / addressed, or we’ve agreed on the enhancement implementation with you, do the following:
40+
41+
1. [Fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) this repository
42+
2. Clone this repository on your machine.
43+
3. Create a separate branch for your changes. If you work on a Jira issue, please include the issue number in the branch name so it reads as `<JIRAISSUE>-my_branch`. This makes it easier to track your contribution.
44+
4. Make your changes. Please follow the guidelines outlined in the [PostgreSQL Coding Standard](https://www.postgresql.org/docs/current/source.html) to improve code readability.
45+
<details>
46+
<summary>.vimrc configuration example</summary>
47+
48+
```
49+
set nocompatible " choose no compatibility with legacy vi
50+
syntax enableset
51+
tabstop=4set
52+
background=lightset
53+
textwidth=80set
54+
colorcolumn=80
55+
let g:filestyle_ignore_patterns = ['^\t* \{1,3}\S']
56+
highlight Normal ctermbg=15
57+
highlight ColorColumn ctermbg=52
58+
```
59+
</details>
60+
61+
5. Test your changes locally. See the [Running tests ](#running-tests) section for more information
62+
6. Update the documentation describing your changes. See the [Contributing to documentation](#contributing-to-documentation) section for details
63+
7. Commit the changes. Add the Jira issue number at the beginning of your message subject, so that is reads as `<JIRAISSUE> : My commit message`. Follow this pattern for your commits:
64+
65+
```
66+
PG-1234: Main commit message.
67+
<Blank line>
68+
Details of fix.
69+
```
70+
71+
The [commit message guidelines](https://gist.github.com/robertpainsi/b632364184e70900af4ab688decf6f53) will help you with writing great commit messages
72+
73+
8. Open a pull request to Percona
74+
9. Our team will review your code and if everything is correct, will merge it. Otherwise, we will contact you for additional information or with the request to make changes.
75+
76+
### Building pg_tde
77+
78+
To build `pg_tde` from source code, you require the following:
79+
80+
* git
81+
* make
82+
* gcc
83+
* pg_config
84+
85+
Refer to the [Building from source code](https://github.com/percona/pg_tde?tab=readme-ov-file#building-from-sources-for-community-postgresql) section for guidelines.
86+
87+
88+
### Running tests
89+
90+
When you work, you should periodically run tests to check that your changes don’t break existing code.
91+
92+
You can find the tests in the `sql` directory.
93+
94+
#### Run manually
95+
96+
1. Change directory to pg_tde
97+
98+
**NOTE**: Make sure `postgres` user is the owner of the `pg_tde` directory
99+
100+
2. Start the tests
101+
1. If you built PostgreSQL from PGDG, use the following command:
102+
103+
```sh
104+
make installcheck
105+
```
106+
107+
108+
2. If you installed PostgreSQL server from Percona Distribution for PostgreSQL, use the following command:
109+
110+
```sh
111+
sudo su postgres bash -c 'make installcheck USE_PGXS=1'
112+
```
113+
#### Run automatically
114+
115+
The tests are run automatically with GitHub actions once you commit and push your changes. Make sure all tests are successfully passed before you proceed.
116+
117+
118+
## Contributing to documentation
119+
120+
`pg_tde` documentation is maintained in the `documentation` directory. Please read the [Contributing guide](https://github.com/percona/pg_tde/blob/main/documentation/CONTRIBUTING.md) for guidelines how you can contribute to the docs.
121+
122+
## After your pull request is merged
123+
124+
Once your pull request is merged, you are an official Percona Community Contributor. Welcome to the community!

contrib/pg_tde/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Percona LLC
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

contrib/pg_tde/Makefile

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# contrib/pg_tde/Makefile
2+
3+
PGFILEDESC = "pg_tde access method"
4+
MODULE_big = pg_tde
5+
EXTENSION = pg_tde
6+
DATA = pg_tde--1.0-beta2.sql
7+
8+
REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/pg_tde/pg_tde.conf
9+
REGRESS = toast_decrypt_basic \
10+
toast_extended_storage_basic \
11+
move_large_tuples_basic \
12+
non_sorted_off_compact_basic \
13+
update_compare_indexes_basic \
14+
pg_tde_is_encrypted_basic \
15+
test_issue_153_fix_basic \
16+
multi_insert_basic \
17+
update_basic \
18+
subtransaction_basic \
19+
trigger_on_view_basic \
20+
change_access_method_basic \
21+
insert_update_delete_basic \
22+
keyprovider_dependency_basic \
23+
vault_v2_test_basic \
24+
alter_index_basic \
25+
merge_join_basic \
26+
tablespace_basic
27+
TAP_TESTS = 1
28+
29+
OBJS = src/encryption/enc_tde.o \
30+
src/encryption/enc_aes.o \
31+
src/access/pg_tde_slot.o \
32+
src/access/pg_tde_tdemap.o \
33+
src$(MAJORVERSION)/access/pg_tde_io.o \
34+
src$(MAJORVERSION)/access/pg_tdeam_visibility.o \
35+
src$(MAJORVERSION)/access/pg_tdeam.o \
36+
src$(MAJORVERSION)/access/pg_tdetoast.o \
37+
src$(MAJORVERSION)/access/pg_tde_prune.o \
38+
src$(MAJORVERSION)/access/pg_tde_vacuumlazy.o \
39+
src$(MAJORVERSION)/access/pg_tde_visibilitymap.o \
40+
src$(MAJORVERSION)/access/pg_tde_rewrite.o \
41+
src$(MAJORVERSION)/access/pg_tdeam_handler.o \
42+
src/access/pg_tde_ddl.o \
43+
src/access/pg_tde_xlog.o \
44+
src/access/pg_tde_xlog_encrypt.o \
45+
src/transam/pg_tde_xact_handler.o \
46+
src/keyring/keyring_curl.o \
47+
src/keyring/keyring_file.o \
48+
src/keyring/keyring_vault.o \
49+
src/keyring/keyring_kmip.o \
50+
src/keyring/keyring_kmip_ereport.o \
51+
src/keyring/keyring_api.o \
52+
src/catalog/tde_global_space.o \
53+
src/catalog/tde_keyring.o \
54+
src/catalog/tde_keyring_parse_opts.o \
55+
src/catalog/tde_principal_key.o \
56+
src/common/pg_tde_shmem.o \
57+
src/common/pg_tde_utils.o \
58+
src/smgr/pg_tde_smgr.o \
59+
src/pg_tde_defs.o \
60+
src/pg_tde_event_capture.o \
61+
src/pg_tde.o \
62+
src/libkmip/libkmip/src/kmip.o \
63+
src/libkmip/libkmip/src/kmip_bio.o \
64+
src/libkmip/libkmip/src/kmip_locate.o \
65+
src/libkmip/libkmip/src/kmip_memset.o
66+
67+
ifdef USE_PGXS
68+
PG_CONFIG = pg_config
69+
PGXS := $(shell $(PG_CONFIG) --pgxs)
70+
override PG_CPPFLAGS += -I$(CURDIR)/src/include -I$(CURDIR)/src/libkmip/libkmip/include -I$(CURDIR)/src$(MAJORVERSION)/include
71+
include $(PGXS)
72+
else
73+
subdir = contrib/pg_tde
74+
top_builddir = ../..
75+
override PG_CPPFLAGS += -I$(top_srcdir)/$(subdir)/src/include -I$(top_srcdir)/$(subdir)/src/libkmip/libkmip/include -I$(top_srcdir)/$(subdir)/src$(MAJORVERSION)/include
76+
include $(top_builddir)/src/Makefile.global
77+
include $(top_srcdir)/contrib/contrib-global.mk
78+
endif
79+
80+
override SHLIB_LINK += -lcurl -lcrypto -lssl
81+
82+
# Fetches typedefs list for PostgreSQL core and merges it with typedefs defined in this project.
83+
# https://wiki.postgresql.org/wiki/Running_pgindent_on_non-core_code_or_development_code
84+
update-typedefs:
85+
wget -q -O - "https://buildfarm.postgresql.org/cgi-bin/typedefs.pl?branch=REL_17_STABLE" | cat - typedefs.list | sort | uniq > typedefs-full.list
86+
87+
# Indents projects sources.
88+
indent:
89+
pgindent --typedefs=typedefs-full.list --excludes=pgindent_excludes .
90+
91+
.PHONY: update-typedefs indent

contrib/pg_tde/Makefile.tools

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
TDE_OBJS = \
2+
src/access/pg_tde_tdemap.frontend \
3+
src/access/pg_tde_xlog_encrypt.frontend \
4+
src/catalog/tde_global_space.frontend \
5+
src/catalog/tde_keyring.frontend \
6+
src/catalog/tde_keyring_parse_opts.frontend \
7+
src/catalog/tde_principal_key.frontend \
8+
src/common/pg_tde_utils.frontend \
9+
src/encryption/enc_aes.frontend \
10+
src/encryption/enc_tde.frontend \
11+
src/keyring/keyring_api.frontend \
12+
src/keyring/keyring_curl.frontend \
13+
src/keyring/keyring_file.frontend \
14+
src/keyring/keyring_vault.frontend \
15+
src/keyring/keyring_kmip.frontend \
16+
src/keyring/keyring_kmip_ereport.frontend \
17+
src/libkmip/libkmip/src/kmip.frontend \
18+
src/libkmip/libkmip/src/kmip_bio.frontend \
19+
src/libkmip/libkmip/src/kmip_locate.frontend \
20+
src/libkmip/libkmip/src/kmip_memset.frontend
21+
22+
%.frontend: %.c
23+
$(CC) $(CPPFLAGS) -c $< -o $@

0 commit comments

Comments
 (0)