Skip to content

Commit

Permalink
.deb packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
libvoid committed Aug 21, 2023
1 parent 7d190b2 commit 5e7ed9f
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 1 deletion.
30 changes: 29 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,32 @@ changelog:
- '^docs:'
- '^test:'
- '^style:'
- '^ci:'
- '^ci:'

nfpms:
id: sshportal
package_name: sshportal
file_name_template: "{{ .ConventionalFileName }}"
vendor: Alterway
maintainer: security@alterway.fr
license: Apache 2.0

formats:
- deb

dependencies:
- systemd

provides:
- sshportal

bindir: /usr/bin

contents:
- src: debian/sshportal/etc/
dst: /etc/
type: tree

scripts:
postinstall: "debian/sshportal/DEBIAN/postinst"
postremove: "debian/sshportal/DEBIAN/postrm"
5 changes: 5 additions & 0 deletions debian/sshportal/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Package: sshportal
Version: 1.0
Architecture: amd64
Maintainer: Alter Way <security@alterway.fr>
Description: SSH bastion
3 changes: 3 additions & 0 deletions debian/sshportal/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
systemctl daemon-reload
systemctl enable sshportal
systemctl start sshportal
3 changes: 3 additions & 0 deletions debian/sshportal/DEBIAN/postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rm /etc/systemd/system/sshportal.service
systemctl daemon-reload
systemctl reset-failed
47 changes: 47 additions & 0 deletions debian/sshportal/etc/systemd/system/sshportal.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[Unit]
After=ssh.service

[Service]
Type=exec
DynamicUser=yes
User=sshportal
#Restart=on-failure
RestartSec=10s
StandardOutput=append:/var/log/sshportal/audit/audit.log
LogsDirectory=sshportal
StateDirectory=sshportal
Environment=SSHPORTAL_LOGS_LOCATION=/var/log/sshportal/session
Environment=SSHPORTAL_DATABASE_URL=/var/lib/sshportal/sshportal.db
ExecStartPre=mkdir -p /var/log/sshportal/audit
ExecStart=/usr/bin/sshportal server
ExecStop=/bin/kill -SIGTERM $MAINPID

ProtectSystem=full
DevicePolicy=closed
DeviceAllow=/dev/tpm0
DeviceAllow=/dev/tpmrm0
ProtectKernelLogs=true
ProtectProc=invisible
PrivateUsers=true
ProtectHome=true
UMask=0077
RestrictNamespaces=true
LockPersonality=true
NoNewPrivileges=true
ProtectKernelModules=true
SystemCallArchitectures=native
ProtectHostname=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
RestrictRealtime=true
ProtectControlGroups=true
ProtectKernelTunables=true
RestrictSUIDSGID=true
ProtectClock=true
SystemCallFilter=@system-service
SystemCallFilter=~@privileged @resources
SystemCallFilter=setrlimit
CapabilityBoundingSet=
MemoryDenyWriteExecute=true

[Install]
WantedBy=default.target

0 comments on commit 5e7ed9f

Please sign in to comment.