Skip to content

Commit 4d4045b

Browse files
authored
Merge pull request #135 from oracle/tls-session-tags
2 parents ddffadb + 578d5ae commit 4d4045b

24 files changed

Lines changed: 3063 additions & 50 deletions

.github/workflows/documentation.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ jobs:
4141
libkeyutils-dev \
4242
libnl-3-dev \
4343
libnl-genl-3-dev \
44-
libglib2.0-dev
44+
libglib2.0-dev \
45+
libyaml-dev
4546
4647
- name: Install documentation tools
4748
run: |
@@ -54,7 +55,7 @@ jobs:
5455
- name: Configure
5556
run: |
5657
./autogen.sh
57-
./configure --with-systemd
58+
./configure --with-systemd --enable-session-tags
5859
5960
- name: Generate HTML man pages
6061
run: |

.github/workflows/makefile.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ jobs:
2626
libkeyutils-dev \
2727
libnl-3-dev \
2828
libnl-genl-3-dev \
29-
libglib2.0-dev
29+
libglib2.0-dev \
30+
libyaml-dev
3031
3132
- name: Configure
3233
run: |
3334
./autogen.sh
34-
./configure --with-systemd
35+
./configure --with-systemd --enable-session-tags
3536
3637
- name: Build
3738
run: make
@@ -40,7 +41,7 @@ jobs:
4041
run: make check
4142

4243
- name: Distcheck
43-
run: make distcheck
44+
run: make distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-session-tags"
4445

4546
build-musl:
4647

@@ -69,13 +70,14 @@ jobs:
6970
keyutils-dev \
7071
libnl3-dev \
7172
glib-dev \
73+
yaml-dev \
7274
linux-headers \
7375
tar
7476
7577
- name: Configure
7678
run: |
7779
./autogen.sh
78-
./configure --with-systemd
80+
./configure --with-systemd --enable-session-tags
7981
8082
- name: Build
8183
run: make
@@ -84,4 +86,4 @@ jobs:
8486
run: make check
8587

8688
- name: Distcheck
87-
run: make distcheck
89+
run: make distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-session-tags"

.github/workflows/static.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222
libkeyutils-dev \
2323
libnl-3-dev \
2424
libnl-genl-3-dev \
25-
libglib2.0-dev
25+
libglib2.0-dev \
26+
libyaml-dev
2627
2728
- name: Install tools
2829
run: |
@@ -31,7 +32,7 @@ jobs:
3132
- name: Configure
3233
run: |
3334
./autogen.sh
34-
./configure --with-systemd
35+
./configure --with-systemd --enable-session-tags
3536
3637
- name: Generate compile commands
3738
run: |
@@ -64,7 +65,8 @@ jobs:
6465
libkeyutils-dev \
6566
libnl-3-dev \
6667
libnl-genl-3-dev \
67-
libglib2.0-dev
68+
libglib2.0-dev \
69+
libyaml-dev
6870
6971
- name: Install tools
7072
run: |
@@ -73,7 +75,7 @@ jobs:
7375
- name: Configure
7476
run: |
7577
./autogen.sh
76-
./configure --with-systemd
78+
./configure --with-systemd --enable-session-tags
7779
7880
- name: Run Lizard Complexity Analysis
7981
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ configure
66
configure~
77
cscope.*
88
docs/doxygen/
9+
docs/Doxyfile
910
Makefile
1011
Makefile.in
1112
.deps/

INSTALL

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@ Normal instructions for building ktls-utils
1010
# systemctl enable --now tlshd
1111

1212

13+
Configure options
14+
-----------------
15+
16+
--with-systemd[=DIR] Install systemd unit files. If DIR is
17+
specified, unit files are installed there;
18+
otherwise /usr/lib/systemd/system is used.
19+
20+
--enable-session-tags Build with TLS session tags support. When
21+
enabled, tlshd can match incoming peer
22+
certificates against policy files in
23+
/etc/tlshd/tags.d/.
24+
25+
1326
Additional configuration information is provided in the generic
1427
instructions below.
1528

README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ following libraries to be installed:
3333
* keyutils
3434
* GLib-2.0
3535
* libnl3
36+
* libyaml
3637

3738
## Installation
3839

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ following libraries to be installed:
3333
* keyutils
3434
* GLib-2.0
3535
* libnl3
36+
* libyaml
3637

3738
## Installation
3839

configure.ac

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ AC_ARG_WITH(systemd,
4747
AM_CONDITIONAL(INSTALL_SYSTEMD, [test "$use_systemd" = 1])
4848
AC_SUBST(unitdir)
4949

50+
AC_ARG_ENABLE(session-tags,
51+
[AS_HELP_STRING([--enable-session-tags],
52+
[enable TLS session tags support @<:@Default: no@:>@])],
53+
[enable_session_tags=$enableval],
54+
[enable_session_tags=no])
55+
AM_CONDITIONAL(HAVE_SESSION_TAGS, [test "x$enable_session_tags" = xyes])
56+
if test "x$enable_session_tags" = xyes ; then
57+
AC_DEFINE([HAVE_SESSION_TAGS], [1],
58+
[Define to 1 to enable TLS session tags support])
59+
fi
60+
5061
PKG_PROG_PKG_CONFIG([0.9.0])
5162
PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 3.3.0])
5263
AC_SUBST([LIBGNUTLS_CFLAGS])
@@ -63,6 +74,11 @@ AC_SUBST([LIBNL3_LIBS])
6374
PKG_CHECK_MODULES([LIBNL_GENL3], libnl-genl-3.0 >= 3.1)
6475
AC_SUBST([LIBNL_GENL3_CFLAGS])
6576
AC_SUBST([LIBNL_GENL3_LIBS])
77+
if test "x$enable_session_tags" = xyes ; then
78+
PKG_CHECK_MODULES([LIBYAML], [yaml-0.1])
79+
AC_SUBST([LIBYAML_CFLAGS])
80+
AC_SUBST([LIBYAML_LIBS])
81+
fi
6682

6783
AC_CHECK_PROG(DOXYGEN, doxygen, doxygen, false)
6884
if test "$DOXYGEN" = false; then
@@ -88,6 +104,12 @@ AC_CHECK_LIB([gnutls], [gnutls_psk_allocate_client_credentials2],
88104
AC_CHECK_LIB([gnutls], [gnutls_record_get_max_send_size],
89105
[AC_DEFINE([HAVE_GNUTLS_RECORD_GET_MAX_SEND_SIZE], [1],
90106
[Define to 1 if you have the gnutls_record_get_max_send_size function.])])
107+
AC_CHECK_LIB([glib-2.0], [g_pattern_spec_match],
108+
[AC_DEFINE([HAVE_GLIB_G_PATTERN_SPEC_MATCH], [1],
109+
[Define to 1 if you have the g_pattern_spec_match function.])])
110+
AC_CHECK_LIB([glib-2.0], [g_pattern_spec_match_string],
111+
[AC_DEFINE([HAVE_GLIB_G_PATTERN_SPEC_MATCH_STRING], [1],
112+
[Define to 1 if you have the g_pattern_spec_match_string function.])])
91113

92114
AC_MSG_CHECKING(for ML-DSA support in gnutls)
93115
AC_COMPILE_IFELSE(
@@ -120,6 +142,7 @@ AC_CONFIG_FILES([Makefile \
120142
etc/tlshd/Makefile \
121143
man/Makefile \
122144
man/man5/Makefile \
145+
man/man7/Makefile \
123146
man/man8/Makefile \
124147
src/Makefile \
125148
src/tlshd/Makefile \

etc/tlshd/Makefile.am

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@
1717
#
1818

1919
tlshdconfigdir = $(sysconfdir)/tlshd
20-
2120
dist_tlshdconfig_DATA = config
2221

22+
if HAVE_SESSION_TAGS
23+
tlshdtagsdir = $(tlshdconfigdir)/tags.d
24+
dist_tlshdtags_DATA = tags.example
25+
endif
26+
2327
MAINTAINERCLEANFILES = Makefile.in
2428

2529
install-exec-hook:
2630
mkdir -p $(DESTDIR)$(tlshdconfigdir)
27-
28-
uninstall-hook:
29-
rm -rf $(DESTDIR)$(tlshdconfigdir)
31+
if HAVE_SESSION_TAGS
32+
mkdir -p $(DESTDIR)$(tlshdtagsdir)
33+
endif

etc/tlshd/tags.example

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
filters:
3+
monsters-university:
4+
type: "x509.tbs.issuer"
5+
pattern: "*,O=Monsters University,*"
6+
fear-tech:
7+
type: "x509.tbs.issuer"
8+
pattern: "*,O=Fear Technology Institute,*"
9+
school-scaring:
10+
type: "x509.tbs.subject"
11+
pattern: "*,OU=School of Scaring,*"
12+
school-can-design:
13+
type: "x509.tbs.subject"
14+
pattern: "*,OU=School of Scream Can Design,*"
15+
sorority-hss:
16+
type: "x509.tbs.subject"
17+
pattern: "*,OU=Eta Hiss Hiss,*"
18+
fraternity-ror:
19+
type: "x509.tbs.subject"
20+
pattern: "*,OU=Roar Omega Roar,*"
21+
fraternity-ok:
22+
type: "x509.tbs.subject"
23+
pattern: "*,OU=Oozma Kappa,*"
24+
valid-keyusage:
25+
type: "x509.extension.keyUsage"
26+
purpose:
27+
- "digitalSignature"
28+
- "nonRepudiation"
29+
30+
tags:
31+
ror-mu-chapter:
32+
filter:
33+
- "monsters-university"
34+
- "fraternity-ror"
35+
- "valid-keyusage"
36+
ror-ft-chapter:
37+
filter:
38+
- "fear-tech"
39+
- "fraternity-ror"
40+
- "valid-keyusage"
41+
can-design-student-materials:
42+
filter:
43+
- "school-can-design"

0 commit comments

Comments
 (0)