Managing FastAPI Projects with Poetry: A Step-by-Step Guide

Image
This guide will walk you through how to use Poetry to manage dependencies and structure your project in FastAPI . It includes detailed explanations of Poetry's core concepts and commands to help prevent issues that can arise during team collaboration and deployment. 1. What is Poetry? Poetry is a dependency management and packaging tool for Python. It goes beyond simply installing libraries by allowing you to clearly declare the dependencies your project needs and ensuring that all developers on the project have the same library versions. Clarity in Dependency Management : Explicitly manage your project's basic information and required libraries through the pyproject.toml file. Reproducible Builds : By locking all dependency versions in the poetry.lock file, it fundamentally prevents "it works on my machine" problems. Integrated Development Environment : It automatically creates and manages isolated virtual environments for each project and handles mo...

How to Set an SSH Login Banner on Ubuntu 24.04

This guide walks you through setting up an SSH login banner on Ubuntu 24.04, along with best practices and real-world security tips — including how to prevent accidental logins to production servers, reduce legal exposure, and avoid exposing sensitive OS details.

The benefits of SSH Login Banner

  • Legal Notice: Warns unauthorized users and may help with legal defense.
  • Security Deterrent: Reminds users that activity is logged and monitored.
  • Environment Clarity: Helps clearly label dev/staging/prod servers to avoid mistakes.
  • Attack Surface Reduction: Prevents exposing OS/version info (which /etc/issue might leak).

Step 1. Create or Edit the Banner File

Start by creating or editing the banner file that will be displayed before the SSH login prompt. The standard location is /etc/issue.net.

$ sudo vim /etc/issue.net

Sample Banner Text

 #####################################################################
 #  This system is for the use of authorized users only.             #
 #  Individuals using this computer system without authority, or in  #
 #  excess of their authority, are subject to having all of their    #
 #  activities on this system monitored and recorded by system       #
 #  personnel.                                                       #
 #                                                                   #
 #  In the course of monitoring individuals improperly using this    #
 #  system, or in the course of system maintenance, the activities   #
 #  of authorized users may also be monitored.                       #
 #                                                                   #
 #  Anyone using this system expressly consents to such monitoring   #
 #  and is advised that if such monitoring reveals possible          #
 #  evidence of criminal activity, system personnel may provide the  #
 #  evidence of such monitoring to law enforcement officials.        #
 #####################################################################

🔒 Tip: Customize the message based on your organization’s security policies or legal requirements.

Step 2. Update the SSH Configuration

Next, update the SSH daemon configuration to reference the banner file.

$ sudo vim /etc/ssh/sshd_config

Find and update the following lines:

#Banner none
Banner /etc/issue.net

Ensure that the path is an absolute path and the file exists.

Step 3. Restart the SSH Service

Apply the configuration changes by restarting the SSH service:

$ sudo systemctl restart ssh

Tip) Related Login Message Files

File Path Description
/etc/issue Banner shown before local console login
/etc/issue.net Banner shown before SSH login
/etc/motd Message of the Day shown after login

⚠️ Note: The SSH Banner message is not displayed during SFTP logins.

Comments

Popular posts from this blog

Resolving Key Exchange Failure When Connecting with SecureCRT to OpenSSH

SecureCRT] How to Back Up and Restore SecureCRT Settings on Windows

How to Set Up Vaultwarden (Bitwarden) on Synology NAS (Best Free Alternative to LastPass)