Skip to content

Commit 2e913fd

Browse files
committed
Packaging updates supporting the use of immutable scripts, includes and config
1 parent 74b0ab8 commit 2e913fd

11 files changed

+136
-44
lines changed

docs/WISHLIST.txt renamed to PLANNING.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
*Blocking For 1.0 Release*
1+
**Blocking For 1.0 Release**
22

33
* Code review, fix up input validation and graceful error handling/logging.
44

55
* Fix rolefile interpreter bug
66

77

8+
**Planned Post 1.0 Enhancements**
89

9-
*Possible Future Enhancements*
10+
* Migrate server to systemd
11+
12+
* IN PROGRESS - Migrate functions (including data) into a libexec folder to allow alternate data stores.
13+
14+
* Merge multiple matching permissions.
15+
16+
17+
18+
**Possible Future Enhancements (Suggestions)**
1019

1120
* Write reason for authentication failure into the session record.
1221

@@ -24,18 +33,12 @@
2433
host, and/or to determine why they were not permitted access,
2534
(require SYSTEM (or lower?) rights so it's not publically available).
2635

27-
* Move audit name/command list into a configuration file.
28-
29-
* Merge multiple matching permissions.
36+
* Move audit name/command list into a configuration file.
3037

3138
* for static keys, put comment in logs to show which key it is.
3239

33-
* STARTED - Migrate data functions into a libexec folder to allow alternate data stores.
34-
35-
36-
3740

38-
*Archive/Completed Fixes & Changes
41+
**Archive/Completed Fixes & Changes**
3942

4043
* DONE - Default role definition assigned to a host with no other role config.
4144

QUICKSTART.txt

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
1+
**Building Packages**
12

2-
*Building Packages*
3+
NOTE: Building the packages is for advanced users/testers only, you can
4+
obtain packages in the normal way from OS repos by looking here:-
5+
6+
https://netlore.github.io/OpenAKC/download/
37

48

59
_Debian/Ubuntu_
610

711
To create ".deb" packages for Debian/Ubuntu, simply download the repo using
812
whatever method you prefer, then, as the "root" user, cd into the folder, and
913
run "./makedebs.sh". Watch for unexpected errors, and assuming there are no
10-
issues you will find that the required 3 .deb packages appear in the same
11-
folder as the "makedebs.sh" script.
14+
issues you will find that the required 4 .deb packages appear in the same
15+
folder as the "makedebs.sh" script. Be sure to move them aside as they may
16+
interfere with some of the "contrib" tools.
1217

1318

1419
_Redhat_
1520

1621
Collect the zip for "master", or for a release version, place it in the SOURCES
17-
folder of a working "rpmbuild" environment, Eg:-
22+
folder of a working "rpmbuild" environment (Configuring an RPM build
23+
environment is not covered here), Eg:-
1824

1925
cd ~/rpmbuild/SOURCES
2026
wget https://github.com/netlore/OpenAKC/archive/master.zip
2127

22-
Then extract the zip so that the associated "openakc.spec" file is available,
28+
Then extract the zip so that the associated "openakc-rhel.spec" file is available,
2329
and run rpmbuild to create the packages Eg:-
2430

2531
unzip master.zip
@@ -28,15 +34,19 @@ rpmbuild -ba OpenAKC-master/openakc.spec
2834
If nothing goes wrong, the RPM's will appear in the build environments "RPMS"
2935
folder.
3036

37+
_SuSE_
38+
39+
As for RedHat, except if you build as root, it will already have a
40+
preconfigured RPM build environment in /usr/src
3141

3242

33-
*Quickstart Guide*
43+
**Quickstart Guide**
3444

3545

3646
_Server Installation_
3747

38-
If installing from packages's rather than a repo, you may first need to ensure
39-
that some dependencies are installed. At the time of writing, a standard
48+
If installing from compiledpackages's rather than a repo, you may first need to
49+
ensure that some dependencies are installed. At the time of writing, a standard
4050
minimal "CentOS container" requires several packages to be installed
4151
in addition to the default:-
4252

@@ -59,6 +69,9 @@ updates.
5969
register their keys, and administrators to upload static keys and configure
6070
permissions.
6171

72+
3) "openakc-shared" which contains functions shared between all openakc
73+
components.
74+
6275
To verify that the server is working, simply type "openakc ping" after
6376
installing the server packages. This should force the server to write out
6477
a default configuration and reply with "OK: Pong!"
@@ -77,7 +90,7 @@ yum install e2fsprogs openssh-clients openssh-server openssl which
7790
For a minimal Ubuntu, installing extra dependencies is currently not
7891
required on the client host.
7992

80-
Once any dependencies are met, simply install package "openakc"
93+
Once any dependencies are met, install packages "openakc" & "openakc-shared"
8194

8295
To set up the client, ensure that the host(s) listed in the client config
8396
(/etc/openakc/openakc.conf) (which can be either name or IP) are configured
@@ -86,6 +99,11 @@ to refer to the appropriate server. The configuration is pre-populated with
8699
configured in DNS, or in the /etc/hosts on the client for testing, or alter
87100
them as you prefer.
88101

102+
NOTE: Before attempting to edit this file, you are advised to read the
103+
assocated "readme" - /etc/openakc/openakc.conf.readme, since the OpenAKC
104+
client installation marks its configuration "immutable" to avoid casual
105+
editing of those files by users you may need to grant root access.
106+
89107
To verify that the client is configured, and can contact the server, after
90108
installation, you can run "openakc-plugin ping". The plugin only has very
91109
minimal command line functions, but if for any reason you rebuild the
@@ -137,15 +155,16 @@ guide however, we will not discuss distributed systems.
137155
This user will now be able to run call the role management functions in the
138156
api tool Eg:-
139157

140-
"openakc editrole root@test-client"
158+
"openakc editrole root@DEFAULT" (Default rolefile is applied to hosts not
159+
yet configured explicitly, so it is a useful way to get started).
141160

142161
Examine the comments, and example role "block" shown, and create one
143162
defining access for a user or group.
144163

145164
The role data can also be uploaded or downloaded using the "getrole" or
146165
"setrole" commands with a filename as an extra parameter Eg:-
147166

148-
"openakc getrole root@test-client /tmp/role.txt"
167+
"openakc getrole root@DEFAULT /tmp/role.txt"
149168

150169
This will get the role and write it to the file /tmp/role.txt... you can then
151170
edit it and upload it. "setrole" could be used to upload roles without first
@@ -164,13 +183,19 @@ You can examine the logs on each host to see what was logged, as well as check
164183
the keystroke log written to /var/lib/openakc/keylogs on the server, as well as
165184
the configuration audit data in /var/lib/openakc/audit on the server.
166185

167-
For further details please see the full documentation.
186+
For further details please see the full documentation which can be found at
187+
the web site:-
168188

189+
https://netlore.github.io/OpenAKC/
169190

191+
Note: At the time of writing, the documentation is incomplete, feel free to
192+
assist with this, or make suggestions at the GitHub site.
170193

171194
*Related software*
172195

173196
OpenAKC makes use of hpenc, by Vsevolod Stakhov and libsodium by Frank Denis,
174-
these tools are included unmodified, in the source package for OpenAKC and
175-
specific licence terms for these tools are included in separate LICENCE-* files
176-
and in the documentation directory deployed by OpenAKC packages.
197+
these tools are included with minor modifications (in the case of hpenc) to
198+
ensure successful compilation on newer versions of GCC, in the source package
199+
for OpenAKC and specific licence terms for these tools are included in
200+
separate LICENCE-* files and in the documentation directory deployed by
201+
OpenAKC packages.

contrib/debian-lxc-build+demo.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,16 @@ if [ ${REBUILD} -eq 1 ]; then
296296
echo
297297
fi
298298
#
299+
if [ "x${MODE}" == "xunprivilaged" ]; then
300+
LXCROOT="${HOME}/.local/share/lxc"
301+
else
302+
LXCROOT="/var/lib/lxc"
303+
chattr -R -i /var/lib/lxc/openakc-combined 2> /dev/null
304+
chattr -R -i /var/lib/lxc/openakc-client 2> /dev/null
305+
chattr -R -a /var/lib/lxc/openakc-combined 2> /dev/null
306+
chattr -R -a /var/lib/lxc/openakc-client 2> /dev/null
307+
fi
308+
#
299309
echo "Destroying old containers..."
300310
echo
301311
printf "${WHITE}"
@@ -332,12 +342,6 @@ fi
332342
#
333343
# OK, lets get our containers ready to use, and build our packages
334344
#
335-
if [ "x${MODE}" == "xunprivilaged" ]; then
336-
LXCROOT="${HOME}/.local/share/lxc"
337-
else
338-
LXCROOT="/var/lib/lxc"
339-
fi
340-
#
341345
if [ ${DNSFIX} -eq 1 ]; then
342346
printf "${CYAN}Applying DNS fix to containers${WHITE}\n"
343347
echo

makedeb.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
source /etc/os-release
77
VERSION="1.0.0~alpha14"
8-
BUILD="1"
8+
BUILD="4"
99

1010
#
1111
# Package requirements for build
@@ -204,6 +204,7 @@ cp bin/openakc-hpenc "${PDIR}/usr/bin/openakc-hpenc"
204204
cp bin/openakc-server.x "${PDIR}/usr/sbin/openakc-server"
205205
cp resources/deb_postinst-server "${PDIR}/DEBIAN/postinst"
206206
cp resources/deb_postrm-server "${PDIR}/DEBIAN/postrm"
207+
cp resources/deb_preinst-server "${PDIR}/DEBIAN/preinst"
207208
cp resources/openakc-sudoers "${PDIR}/etc/sudoers.d/openakc"
208209
cp resources/openakc-xinetd "${PDIR}/etc/xinetd.d/openakc"
209210
cp docs/OpenAKC_Admin_Guide.pdf "${PDIR}/usr/share/doc/openakc-server/"
@@ -238,22 +239,25 @@ PDIR="openakc-shared_${RELEASE}_amd64"
238239
#
239240
mkdir -p "${PDIR}/DEBIAN"
240241
mkdir -p "${PDIR}/var/lib/openakc/libexec"
241-
##mkdir -p "${PDIR}/usr/bin"
242242
mkdir -p "${PDIR}/usr/share/doc/openakc-shared"
243243
mkdir -p "${PDIR}/etc/rsyslog.d"
244244
#
245245
cp bin/openakc-functions "${PDIR}/var/lib/openakc/libexec/functions-${RELEASE}"
246246
cp resources/openakc-rsyslog "${PDIR}/etc/rsyslog.d/99-openakc.conf"
247+
cp resources/deb_preinst-shared "${PDIR}/DEBIAN/preinst"
248+
sed -e "s,%RELEASE%,$RELEASE,g" resources/deb_postinst-shared > "${PDIR}/DEBIAN/postinst"
247249
sed -e "s,%RELEASE%,$RELEASE,g" resources/deb_prerm-shared > "${PDIR}/DEBIAN/prerm"
248-
##cp resources/openakc-rsyslog "${PDIR}/etc/rsyslog.d/99-openakc.conf"
250+
cp resources/deb_postrm-shared "${PDIR}/DEBIAN/postrm"
249251
cp LICENSE "${PDIR}/usr/share/doc/openakc-shared/"
250-
##cp QUICKSTART.txt "${PDIR}/usr/share/doc/openakc-tools/"
251252
#
252253
##chmod 755 "${PDIR}/usr/bin/openakc"
253254
chmod 640 "${PDIR}/etc/rsyslog.d/99-openakc.conf"
254255
chmod 644 "${PDIR}/var/lib/openakc/libexec/functions-${RELEASE}"
255256
chmod 755 "${PDIR}/var/lib/openakc/libexec"
257+
chmod 755 "${PDIR}/DEBIAN/preinst"
258+
chmod 755 "${PDIR}/DEBIAN/postinst"
256259
chmod 755 "${PDIR}/DEBIAN/prerm"
260+
chmod 755 "${PDIR}/DEBIAN/postrm"
257261

258262
#
259263
echo "Package: openakc-shared" > "${PDIR}/DEBIAN/control"

openakc-rhel.spec

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Name: openakc
22
Version: 1.0.0~alpha14
3-
Release: 1%{?dist}
3+
Release: 4%{?dist}
44
Summary: This OpenAKC "client" package contains the client ssh plugin which queries the API for authentication information.
55
Group: Applications/System
66
License: GPLv2.0
@@ -183,6 +183,14 @@ passwd -u openakc 2> /dev/null 1> /dev/null
183183
[ -f /usr/sbin/openakc-plugin ]&&chattr -i /usr/sbin/openakc-plugin
184184
exit 0
185185

186+
%pre server
187+
[ -d /var/lib/openakc ]&&chattr -a /var/lib/openakc
188+
exit 0
189+
190+
%pre shared
191+
[ -d /var/lib/openakc/libexec ]&&chattr -i /var/lib/openakc/libexec
192+
exit 0
193+
186194
%post
187195
#echo "Postroll = $*"
188196
setcap CAP_SETPCAP+ep /usr/bin/openakc-cap
@@ -197,8 +205,6 @@ chattr +i /usr/bin/openakc-cap
197205
chattr +i /usr/bin/openakc-hpenc
198206
chattr +i /usr/bin/openakc-session
199207
chattr +i /usr/sbin/openakc-plugin
200-
chattr +i /var/lib/openakc/libexec/functions-%{version}-%{release}
201-
chattr +i /var/lib/openakc/libexec
202208
chattr +a /var/lib/openakc
203209
#chattr +a /etc/ssh
204210
#chattr +i /etc/ssh/sshd_config
@@ -215,6 +221,11 @@ echo "openakc 889/tcp # OpenAKC Authentication Protocol" >> /e
215221
/sbin/service xinetd restart > /dev/null 2>&1 || :
216222
exit 0
217223

224+
%post shared
225+
chattr +i /var/lib/openakc/libexec
226+
chattr +i /var/lib/openakc/libexec/functions-%{version}-%{release}
227+
exit 0
228+
218229
%preun
219230
[ -d /etc/openakc ]&&chattr -i /etc/openakc
220231
[ -d /var/lib/openakc ]&&chattr -a /var/lib/openakc
@@ -266,6 +277,9 @@ case "$*" in
266277
esac
267278
exit 0
268279

280+
%postun shared
281+
[ -d /var/lib/openakc ]&&chattr +a /var/lib/openakc
282+
exit 0
269283

270284
%files
271285
%defattr(-,root,root,-)

openakc-suse.spec

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Name: openakc
22
Version: 1.0.0~alpha14
3-
Release: 2%{?dist}
3+
Release: 4%{?dist}
44
Summary: This OpenAKC "client" package contains the client ssh plugin which queries the API for authentication information.
55
Group: Applications/System
66
License: GPLv2.0
@@ -183,6 +183,14 @@ passwd -u openakc 2> /dev/null 1> /dev/null
183183
[ -f /usr/sbin/openakc-plugin ]&&chattr -i /usr/sbin/openakc-plugin
184184
exit 0
185185

186+
%pre server
187+
[ -d /var/lib/openakc ]&&chattr -a /var/lib/openakc
188+
exit 0
189+
190+
%pre shared
191+
[ -d /var/lib/openakc/libexec ]&&chattr -i /var/lib/openakc/libexec
192+
exit 0
193+
186194
%post
187195
#echo "Postroll = $*"
188196
setcap CAP_SETPCAP+ep /usr/bin/openakc-cap
@@ -197,8 +205,6 @@ chattr +i /usr/bin/openakc-cap
197205
chattr +i /usr/bin/openakc-hpenc
198206
chattr +i /usr/bin/openakc-session
199207
chattr +i /usr/sbin/openakc-plugin
200-
chattr +i /var/lib/openakc/libexec/functions-%{version}-%{release}
201-
chattr +i /var/lib/openakc/libexec
202208
chattr +a /var/lib/openakc
203209
#chattr +a /etc/ssh
204210
#chattr +i /etc/ssh/sshd_config
@@ -215,6 +221,11 @@ echo "openakc 889/tcp # OpenAKC Authentication Protocol" >> /e
215221
/sbin/service xinetd restart > /dev/null 2>&1 || :
216222
exit 0
217223

224+
%post shared
225+
chattr +i /var/lib/openakc/libexec
226+
chattr +i /var/lib/openakc/libexec/functions-%{version}-%{release}
227+
exit 0
228+
218229
%preun
219230
[ -d /etc/openakc ]&&chattr -i /etc/openakc
220231
[ -d /var/lib/openakc ]&&chattr -a /var/lib/openakc
@@ -266,6 +277,9 @@ case "$*" in
266277
esac
267278
exit 0
268279

280+
%postun shared
281+
[ -d /var/lib/openakc ]&&chattr +a /var/lib/openakc
282+
exit 0
269283

270284
%files
271285
%defattr(-,root,root,-)

resources/deb_postinst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ case "$1" in
88
sed -i "s,^#AuthorizedKeysCommandUser .*$,AuthorizedKeysCommandUser openakc,g" /etc/ssh/sshd_config
99
service sshd restart > /dev/null 2>&1 || :
1010
chown -R root:openakc /etc/openakc
11-
chown -R openakc:root /var/lib/openakc
11+
chattr -a /var/lib/openakc
12+
chown openakc:root /var/lib/openakc
1213
;;
1314
upgrade|abort-upgrade)
1415
exit 0
@@ -26,8 +27,6 @@ chattr +i /usr/bin/openakc-cap
2627
chattr +i /usr/bin/openakc-hpenc
2728
chattr +i /usr/bin/openakc-session
2829
chattr +i /usr/sbin/openakc-plugin
29-
chattr +i /var/lib/openakc/libexec/functions-%RELEASE%
30-
chattr +i /var/lib/openakc/libexec
3130
chattr +a /var/lib/openakc
3231
#chattr +a /etc/ssh
3332
#chattr +i /etc/ssh/sshd_config

resources/deb_postinst-shared

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
chattr +i /var/lib/openakc/libexec
4+
chattr +i /var/lib/openakc/libexec/functions-%RELEASE%
5+
6+
#DEBHELPER#
7+
8+
exit 0

resources/deb_postrm-shared

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
[ -d /var/lib/openakc ]&&chattr +a /var/lib/openakc
4+
5+
#DEBHELPER#
6+
7+
exit 0

0 commit comments

Comments
 (0)