How To Install libreswan on Fedora 34

libreswan is Internet Key Exchange (IKEv1 and IKEv2) implementation for IPsec

Introduction

In this tutorial we learn how to install libreswan on Fedora 34.

What is libreswan

Libreswan is a free implementation of IPsec & IKE for Linux. IPsec is the Internet Protocol Security and uses strong cryptography to provide both authentication and encryption services. These services allow you to build secure tunnels through untrusted networks. Everything passing through the untrusted net is encrypted by the ipsec gateway machine and decrypted by the gateway at the other end of the tunnel. The resulting tunnel is a virtual private network or VPN. This package contains the daemons and userland tools for setting up Libreswan. Libreswan also supports IKEv2 (RFC7296) and Secure Labeling Libreswan is based on Openswan-2.6.38 which in turn is based on FreeS/WAN-2.04

We can use yum or dnf to install libreswan on Fedora 34. In this tutorial we discuss both methods but you only need to choose one of method to install libreswan.

Install libreswan on Fedora 34 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install libreswan using dnf by running the following command:

sudo dnf -y install libreswan

Install libreswan on Fedora 34 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install libreswan using yum by running the following command:

sudo yum -y install libreswan

How To Uninstall libreswan on Fedora 34

To uninstall only the libreswan package we can use the following command:

sudo dnf remove libreswan

libreswan Package Contents on Fedora 34

/etc/ipsec.conf
/etc/ipsec.d
/etc/ipsec.d/policies
/etc/ipsec.d/policies/block
/etc/ipsec.d/policies/clear
/etc/ipsec.d/policies/clear-or-private
/etc/ipsec.d/policies/portexcludes.conf
/etc/ipsec.d/policies/private
/etc/ipsec.d/policies/private-or-clear
/etc/ipsec.secrets
/etc/logrotate.d/libreswan
/etc/pam.d/pluto
/etc/sysctl.d/50-libreswan.conf
/run/pluto
/usr/lib/.build-id
/usr/lib/.build-id/09
/usr/lib/.build-id/09/a58af681e921d36d9c9c073d1da054de02aa5f
/usr/lib/.build-id/0f
/usr/lib/.build-id/0f/40b46a590a172ff062e01496f04f4bb3d1036a
/usr/lib/.build-id/30
/usr/lib/.build-id/30/e417edac7d597eafe208ae4bb64c0c0d625185
/usr/lib/.build-id/34
/usr/lib/.build-id/34/0f1cb4a89c03188d56c8937d83185c9523e5f7
/usr/lib/.build-id/38
/usr/lib/.build-id/38/5da260484d8958696fcd154a24c0b3bb190ca9
/usr/lib/.build-id/64
/usr/lib/.build-id/64/63b28987a8997de43e52a82f2adf21e5f49a28
/usr/lib/.build-id/73
/usr/lib/.build-id/73/04109fe073dafed961b95096c16636a8478882
/usr/lib/.build-id/94
/usr/lib/.build-id/94/3a676319c4eddebc4f1d6614c59c84083ddd38
/usr/lib/.build-id/9d
/usr/lib/.build-id/9d/89c53306f1bfbe05c824b8d81d21b45831edb1
/usr/lib/.build-id/cc
/usr/lib/.build-id/cc/4f1fccb13ea72e57996c210923a17ec50a5a71
/usr/lib/.build-id/d2
/usr/lib/.build-id/d2/c185a7a8ac4f6e5e46fedd456c5a8390ecf950
/usr/lib/systemd/system/ipsec.service
/usr/lib/tmpfiles.d/libreswan.conf
/usr/libexec/ipsec
/usr/libexec/ipsec/_import_crl
/usr/libexec/ipsec/_plutorun
/usr/libexec/ipsec/_secretcensor
/usr/libexec/ipsec/_stackmanager
/usr/libexec/ipsec/_unbound-hook
/usr/libexec/ipsec/_updown
/usr/libexec/ipsec/_updown.xfrm
/usr/libexec/ipsec/addconn
/usr/libexec/ipsec/algparse
/usr/libexec/ipsec/auto
/usr/libexec/ipsec/barf
/usr/libexec/ipsec/cavp
/usr/libexec/ipsec/ecdsasigkey
/usr/libexec/ipsec/getpeercon_server
/usr/libexec/ipsec/letsencrypt
/usr/libexec/ipsec/look
/usr/libexec/ipsec/newhostkey
/usr/libexec/ipsec/pluto
/usr/libexec/ipsec/readwriteconf
/usr/libexec/ipsec/rsasigkey
/usr/libexec/ipsec/setup
/usr/libexec/ipsec/show
/usr/libexec/ipsec/showhostkey
/usr/libexec/ipsec/verify
/usr/libexec/ipsec/whack
/usr/sbin/ipsec
/usr/share/doc/libreswan
/usr/share/doc/libreswan/CHANGES
/usr/share/doc/libreswan/CHANGES.freeswan.pluto
/usr/share/doc/libreswan/CHANGES.openswan
/usr/share/doc/libreswan/COPYING
/usr/share/doc/libreswan/CREDITS
/usr/share/doc/libreswan/CREDITS.freeswan
/usr/share/doc/libreswan/CREDITS.openswan
/usr/share/doc/libreswan/LICENSE
/usr/share/doc/libreswan/PlutoFlow.png
/usr/share/doc/libreswan/PlutoFlow.svg
/usr/share/doc/libreswan/ProgrammingConventions.txt
/usr/share/doc/libreswan/README.IANA-PEN
/usr/share/doc/libreswan/README.XAUTH
/usr/share/doc/libreswan/README.labeledipsec
/usr/share/doc/libreswan/README.md
/usr/share/doc/libreswan/README.nss
/usr/share/doc/libreswan/README.rfcs
/usr/share/doc/libreswan/README.x509
/usr/share/doc/libreswan/examples
/usr/share/doc/libreswan/examples/hub-spoke.conf
/usr/share/doc/libreswan/examples/ipv6.conf
/usr/share/doc/libreswan/examples/l2tp-cert.conf
/usr/share/doc/libreswan/examples/l2tp-psk.conf
/usr/share/doc/libreswan/examples/linux-linux.conf
/usr/share/doc/libreswan/examples/oe-authnull.conf
/usr/share/doc/libreswan/examples/oe-dnssec-client.conf
/usr/share/doc/libreswan/examples/oe-dnssec-server.conf
/usr/share/doc/libreswan/examples/oe-exclude-dns.conf
/usr/share/doc/libreswan/examples/oe-letsencrypt-README.txt
/usr/share/doc/libreswan/examples/oe-letsencrypt-client.conf
/usr/share/doc/libreswan/examples/oe-letsencrypt-server.conf
/usr/share/doc/libreswan/examples/oe-upgrade-authnull.conf
/usr/share/doc/libreswan/examples/sysctl.conf
/usr/share/doc/libreswan/examples/xauth.conf
/usr/share/doc/libreswan/l2tp-overhead.txt
/usr/share/doc/libreswan/nss-howto.txt
/usr/share/doc/libreswan/opportunistic-v1.historic
/usr/share/doc/libreswan/opportunistic-v1.historic/opportunism-spec.txt
/usr/share/doc/libreswan/opportunistic-v1.historic/opportunism.nr
/usr/share/doc/libreswan/pluto-internals.txt
/usr/share/doc/libreswan/win2k-notes.txt
/usr/share/doc/libreswan/windows-cross-compile.txt
/usr/share/man/man5/ipsec.conf.5.gz
/usr/share/man/man5/ipsec.secrets.5.gz
/usr/share/man/man8/ipsec.8.gz
/usr/share/man/man8/ipsec__import_crl.8.gz
/usr/share/man/man8/ipsec__plutorun.8.gz
/usr/share/man/man8/ipsec__secretcensor.8.gz
/usr/share/man/man8/ipsec__stackmanager.8.gz
/usr/share/man/man8/ipsec__unbound-hook.8.gz
/usr/share/man/man8/ipsec__updown.8.gz
/usr/share/man/man8/ipsec__updown.xfrm.8.gz
/usr/share/man/man8/ipsec_addconn.8.gz
/usr/share/man/man8/ipsec_auto.8.gz
/usr/share/man/man8/ipsec_barf.8.gz
/usr/share/man/man8/ipsec_checknss.8.gz
/usr/share/man/man8/ipsec_ecdsasigkey.8.gz
/usr/share/man/man8/ipsec_import.8.gz
/usr/share/man/man8/ipsec_initnss.8.gz
/usr/share/man/man8/ipsec_letsencrypt.8.gz
/usr/share/man/man8/ipsec_look.8.gz
/usr/share/man/man8/ipsec_newhostkey.8.gz
/usr/share/man/man8/ipsec_pluto.8.gz
/usr/share/man/man8/ipsec_readwriteconf.8.gz
/usr/share/man/man8/ipsec_rsasigkey.8.gz
/usr/share/man/man8/ipsec_setup.8.gz
/usr/share/man/man8/ipsec_show.8.gz
/usr/share/man/man8/ipsec_showhostkey.8.gz
/usr/share/man/man8/ipsec_verify.8.gz
/usr/share/man/man8/ipsec_whack.8.gz
/usr/share/man/man8/pluto.8.gz
/var/lib/ipsec
/var/lib/ipsec/nss
/etc/ipsec.conf
/etc/ipsec.d
/etc/ipsec.d/policies
/etc/ipsec.d/policies/block
/etc/ipsec.d/policies/clear
/etc/ipsec.d/policies/clear-or-private
/etc/ipsec.d/policies/portexcludes.conf
/etc/ipsec.d/policies/private
/etc/ipsec.d/policies/private-or-clear
/etc/ipsec.secrets
/etc/logrotate.d/libreswan
/etc/pam.d/pluto
/etc/sysctl.d/50-libreswan.conf
/run/pluto
/usr/lib/.build-id
/usr/lib/.build-id/50
/usr/lib/.build-id/50/e944af17f15f618f423eb5f55035197f5fa10a
/usr/lib/.build-id/62
/usr/lib/.build-id/62/893990b2ffbb30c1f6f494d1cbedc3f6b81583
/usr/lib/.build-id/8a
/usr/lib/.build-id/8a/cabb7f617ea0e0b7be8ce45d02affcbeecd679
/usr/lib/.build-id/ac
/usr/lib/.build-id/ac/a5a17720e72c1a58795f5295fdc0e05bde33b9
/usr/lib/.build-id/b9
/usr/lib/.build-id/b9/5e05f5c194af93b71f75c28c0d5a5f68dd786a
/usr/lib/.build-id/d5
/usr/lib/.build-id/d5/a0bd89ecd8e5892c6f41f67277d35c93d8ad64
/usr/lib/.build-id/d7
/usr/lib/.build-id/d7/f1707addc82b4d209b82bc3f3d60c70c4e5b93
/usr/lib/.build-id/eb
/usr/lib/.build-id/eb/4a76c25452c03a0c6e5d135b3ca4893751deb7
/usr/lib/.build-id/fb
/usr/lib/.build-id/fb/5adbb7a9daa0886cb9c162ea84ce408cc9481e
/usr/lib/systemd/system/ipsec.service
/usr/lib/tmpfiles.d/libreswan.conf
/usr/libexec/ipsec
/usr/libexec/ipsec/_import_crl
/usr/libexec/ipsec/_plutorun
/usr/libexec/ipsec/_secretcensor
/usr/libexec/ipsec/_stackmanager
/usr/libexec/ipsec/_unbound-hook
/usr/libexec/ipsec/_updown
/usr/libexec/ipsec/_updown.xfrm
/usr/libexec/ipsec/addconn
/usr/libexec/ipsec/algparse
/usr/libexec/ipsec/auto
/usr/libexec/ipsec/barf
/usr/libexec/ipsec/cavp
/usr/libexec/ipsec/letsencrypt
/usr/libexec/ipsec/look
/usr/libexec/ipsec/newhostkey
/usr/libexec/ipsec/pluto
/usr/libexec/ipsec/readwriteconf
/usr/libexec/ipsec/rsasigkey
/usr/libexec/ipsec/setup
/usr/libexec/ipsec/show
/usr/libexec/ipsec/showhostkey
/usr/libexec/ipsec/verify
/usr/libexec/ipsec/whack
/usr/sbin/ipsec
/usr/share/doc/libreswan
/usr/share/doc/libreswan/CHANGES
/usr/share/doc/libreswan/CHANGES.freeswan.pluto
/usr/share/doc/libreswan/CHANGES.openswan
/usr/share/doc/libreswan/COPYING
/usr/share/doc/libreswan/CREDITS
/usr/share/doc/libreswan/CREDITS.freeswan
/usr/share/doc/libreswan/CREDITS.openswan
/usr/share/doc/libreswan/LICENSE
/usr/share/doc/libreswan/PlutoFlow.png
/usr/share/doc/libreswan/PlutoFlow.svg
/usr/share/doc/libreswan/ProgrammingConventions.txt
/usr/share/doc/libreswan/README.IANA-PEN
/usr/share/doc/libreswan/README.XAUTH
/usr/share/doc/libreswan/README.labeledipsec
/usr/share/doc/libreswan/README.md
/usr/share/doc/libreswan/README.nss
/usr/share/doc/libreswan/README.rfcs
/usr/share/doc/libreswan/README.x509
/usr/share/doc/libreswan/examples
/usr/share/doc/libreswan/examples/hub-spoke.conf
/usr/share/doc/libreswan/examples/ipv6.conf
/usr/share/doc/libreswan/examples/l2tp-cert.conf
/usr/share/doc/libreswan/examples/l2tp-psk.conf
/usr/share/doc/libreswan/examples/linux-linux.conf
/usr/share/doc/libreswan/examples/mast-l2tp-psk.conf
/usr/share/doc/libreswan/examples/oe-authnull.conf
/usr/share/doc/libreswan/examples/oe-dnssec-client.conf
/usr/share/doc/libreswan/examples/oe-dnssec-server.conf
/usr/share/doc/libreswan/examples/oe-exclude-dns.conf
/usr/share/doc/libreswan/examples/oe-letsencrypt-README.txt
/usr/share/doc/libreswan/examples/oe-letsencrypt-client.conf
/usr/share/doc/libreswan/examples/oe-letsencrypt-server.conf
/usr/share/doc/libreswan/examples/oe-upgrade-authnull.conf
/usr/share/doc/libreswan/examples/sysctl.conf
/usr/share/doc/libreswan/examples/xauth.conf
/usr/share/doc/libreswan/l2tp-overhead.txt
/usr/share/doc/libreswan/nss-howto.txt
/usr/share/doc/libreswan/opportunistic-v1.historic
/usr/share/doc/libreswan/opportunistic-v1.historic/opportunism-spec.txt
/usr/share/doc/libreswan/opportunistic-v1.historic/opportunism.nr
/usr/share/doc/libreswan/pluto-internals.txt
/usr/share/doc/libreswan/win2k-notes.txt
/usr/share/doc/libreswan/windows-cross-compile.txt
/usr/share/man/man5/ipsec.conf.5.gz
/usr/share/man/man5/ipsec.secrets.5.gz
/usr/share/man/man8/ipsec.8.gz
/usr/share/man/man8/ipsec__import_crl.8.gz
/usr/share/man/man8/ipsec__plutorun.8.gz
/usr/share/man/man8/ipsec__secretcensor.8.gz
/usr/share/man/man8/ipsec__stackmanager.8.gz
/usr/share/man/man8/ipsec__unbound-hook.8.gz
/usr/share/man/man8/ipsec__updown.8.gz
/usr/share/man/man8/ipsec__updown.xfrm.8.gz
/usr/share/man/man8/ipsec_addconn.8.gz
/usr/share/man/man8/ipsec_auto.8.gz
/usr/share/man/man8/ipsec_barf.8.gz
/usr/share/man/man8/ipsec_checknss.8.gz
/usr/share/man/man8/ipsec_import.8.gz
/usr/share/man/man8/ipsec_initnss.8.gz
/usr/share/man/man8/ipsec_letsencrypt.8.gz
/usr/share/man/man8/ipsec_look.8.gz
/usr/share/man/man8/ipsec_newhostkey.8.gz
/usr/share/man/man8/ipsec_pluto.8.gz
/usr/share/man/man8/ipsec_readwriteconf.8.gz
/usr/share/man/man8/ipsec_rsasigkey.8.gz
/usr/share/man/man8/ipsec_setup.8.gz
/usr/share/man/man8/ipsec_show.8.gz
/usr/share/man/man8/ipsec_showhostkey.8.gz
/usr/share/man/man8/ipsec_verify.8.gz
/usr/share/man/man8/ipsec_whack.8.gz
/usr/share/man/man8/pluto.8.gz
/var/lib/ipsec
/var/lib/ipsec/nss

References

Summary

In this tutorial we learn how to install libreswan on Fedora 34 using yum and dnf.