-
Notifications
You must be signed in to change notification settings - Fork 0
How to build your own Debian package
Andreas Vögele edited this page Jul 25, 2023
·
3 revisions
Let's create a virtual machine with Vagrant.
mkdir test-nginx
cd test-nginx
vagrant init debian/bookworm64
vagrant up
vagrant ssh
Install the build dependencies.
sudo apt update
sudo apt install -y build-essential debhelper libmojolicious-perl libtemplate-perl
Get the source package.
wget -q --no-parent -r -nd -A .dsc,.diff.gz,.orig.tar.gz \
--accept-regex nginx-auth-saslauthd \
https://download.opensuse.org/repositories/home:/voegelas/Debian_12/
Build the package.
dpkg-source -x nginx-auth-saslauthd_*.dsc
cd nginx-auth-saslauthd-*
dpkg-buildpackage -rfakeroot -uc -us
cd ..
Install the created package and its runtime dependencies.
sudo apt install -y libnss-systemd nginx sasl2-bin
echo START=yes | sudo tee -a /etc/default/saslauthd
sudo systemctl restart saslauthd.service
sudo dpkg -i nginx-auth-saslauthd_*.deb
Edit /etc/nginx/sites-available/default
. Delegate the authentication to the saslauthd daemon with auth_request.
location / {
try_files $uri $uri/ =404;
auth_request /auth;
}
location = /auth {
internal;
proxy_pass http://unix:/run/nginx-auth/saslauthd.sock:/auth-basic;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Realm "This is a test"; # Only ASCII characters are allowed
}
Reload the configuration.
sudo nginx -t
sudo nginx -s reload
Set the vagrant user's password to something that you can easily remember, for example "secret".
sudo passwd vagrant
Test the saslauthd daemon and nginx.
sudo testsaslauthd -s nginx -u vagrant -p 'secret'
wget -S -O - http://localhost/
wget -S -O - http://vagrant:secret@localhost/
Don't forget to configure HTTPS on production.