irax:dc_plus:ftp_service:start
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| irax:dc_plus:ftp_service:start [2025/01/31 16:39] – ian | irax:dc_plus:ftp_service:start [2026/04/24 08:42] (current) – removed 216.73.216.148 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== FTP service configuration ====== | ||
| - | **__FTP service configuration __** | ||
| - | |||
| - | **__Process overview __** | ||
| - | |||
| - | **SFTP logins are **only accepted on the ftpserver, which in turn creates a temporary ssh fuse connection to the target server for the user this also only allows access to the user directory and not to any luther locations | ||
| - | |||
| - | Access from the internet is via ftps.irax.com 185.70.9.229 using port 22 any connection on this address on port 22 is forwarded to the ftpserver on 192.168.10.16 port 2222 | ||
| - | |||
| - | The user ftpconnect needs to be on the target host for the sshfs connection | ||
| - | |||
| - | The sftp server also is open to the internet and attracts unwanted traffic. | ||
| - | |||
| - | There are two methods of managing this - The external pfsense | ||
| - | |||
| - | **SFTP server 192.168.10.16 configuration. | ||
| - | |||
| - | **__A. | ||
| - | |||
| - | **User overview ** | ||
| - | |||
| - | Only available to users having a radius login. Pam radius calls a batch script | ||
| - | |||
| - | / | ||
| - | |||
| - | This script uses the user.conf file where we map the drive to be mounted on a target host. | ||
| - | |||
| - | In order to achieve this we need to configure the following | ||
| - | |||
| - | - SSH User configuration Local ssh user with home directory in a particular location | ||
| - | - SSHD configuration for SSH user ssh in / | ||
| - | - Scripted user creation | ||
| - | - User configuration for mounting sshfs drive. | ||
| - | - PAM modifications and pam radius auth | ||
| - | **1 SSH user configuration** | ||
| - | |||
| - | ** Preliminary conditions.** | ||
| - | |||
| - | There should be a directory | ||
| - | |||
| - | ** Create sftp user as follows ** | ||
| - | |||
| - | useradd -m -s / | ||
| - | mkdir / | ||
| - | chown root:root / | ||
| - | chmod 755 / | ||
| - | chmod 777 / | ||
| - | |||
| - | **2 SSHD configuration**** ** | ||
| - | |||
| - | **Preliminary conditions. | ||
| - | |||
| - | / | ||
| - | |||
| - | subsystem | ||
| - | |||
| - | This config | ||
| - | |||
| - | **Chroot config for ftp users** | ||
| - | |||
| - | A file named< | ||
| - | |||
| - | |||
| - | < | ||
| - | Match Group < | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | </ | ||
| - | |||
| - | **3 Scripted user creation** | ||
| - | |||
| - | Scripts exist for enabling sections 1 and 2 to be done more efficiently. | ||
| - | |||
| - | Scripts are located here: / | ||
| - | |||
| - | | Script| Description | Usage | | ||
| - | | newftpuser.sh| Add new user | ./ | ||
| - | | delftpuser.sh | Delete a user | ./ | ||
| - | | map.sh| Mapping sftp drives per user, called by pam sshd at login | | | ||
| - | | users.conf| User mapping configuration must be manually edited after user is created | | | ||
| - | | sftp.log| Log of connections | tail -sftp.log| | ||
| - | | mountme.sh| Use for testing mounts. | ./ | ||
| - | |||
| - | **4 User configuration for mounting sshfs drive. ** | ||
| - | |||
| - | / | ||
| - | < | ||
| - | | ||
| - | user = < | ||
| - | path = a_folder/ | ||
| - | host = <host Address or name | ||
| - | </code | ||
| - | |||
| - | Note: the path is actually | ||
| - | |||
| - | Eg | ||
| - | < | ||
| - | | ||
| - | user = iw-ian | ||
| - | path = http-sites/ | ||
| - | host = 192.168.10.10 | ||
| - | </ | ||
| - | |||
| - | //**Note 2 Perhaps this could be modified to load config files from a subdirectory . it would be easier to set up a default to be automatically added in newftpuser.sh**// | ||
| - | |||
| - | **5. PAM modifications and pam radius auth** | ||
| - | |||
| - | **/ | ||
| - | |||
| - | We are concerned with the sshd login so edit / | ||
| - | |||
| - | /the following is the current configuration for ubuntu 24.04 LTS | ||
| - | |||
| - | Key additions to the standard sshd file are | ||
| - | |||
| - | auth sufficient pam_radius_auth.so | ||
| - | |||
| - | and | ||
| - | |||
| - | session | ||
| - | |||
| - | ** ** | ||
| - | |||
| - | # PAM configuration for the Secure Shell service | ||
| - | |||
| - | auth sufficient pam_radius_auth.so | ||
| - | |||
| - | # Standard Un*x authentication. | ||
| - | |||
| - | @include common-auth | ||
| - | |||
| - | # Disallow non-root logins when / | ||
| - | |||
| - | account | ||
| - | |||
| - | # Uncomment and edit / | ||
| - | |||
| - | # access limits that are hard to express in sshd_config. | ||
| - | |||
| - | # account | ||
| - | |||
| - | # Standard Un*x authorization. | ||
| - | |||
| - | @include common-account | ||
| - | |||
| - | # SELinux needs to be the first session rule. This ensures that any | ||
| - | |||
| - | # lingering context has been cleared. | ||
| - | |||
| - | # module could execute code in the wrong domain. | ||
| - | |||
| - | #session [success=ok ignore=ignore module_unknown=ignore default=bad] | ||
| - | |||
| - | # Set the loginuid process attribute. | ||
| - | |||
| - | session | ||
| - | |||
| - | # Create a new session keyring. | ||
| - | |||
| - | session | ||
| - | |||
| - | # Standard Un*x session setup and teardown. | ||
| - | |||
| - | @include common-session | ||
| - | |||
| - | # Print the message of the day upon successful login. | ||
| - | |||
| - | # This includes a dynamically generated part from / | ||
| - | |||
| - | # and a static (admin-editable) part from /etc/motd. | ||
| - | |||
| - | session | ||
| - | |||
| - | session | ||
| - | |||
| - | session | ||
| - | |||
| - | # Print the status of the user's mailbox upon successful login. | ||
| - | |||
| - | session | ||
| - | |||
| - | # Set up user limits from / | ||
| - | |||
| - | session | ||
| - | |||
| - | # Read environment variables from / | ||
| - | |||
| - | # / | ||
| - | |||
| - | session | ||
| - | |||
| - | # In Debian 4.0 (etch), locale-related environment variables were moved to | ||
| - | |||
| - | # / | ||
| - | |||
| - | session | ||
| - | |||
| - | # SELinux needs to intervene at login time to ensure that the process starts | ||
| - | |||
| - | # in the proper default security context. | ||
| - | |||
| - | # to run in the user's context should be run after this. | ||
| - | |||
| - | session [success=ok ignore=ignore module_unknown=ignore default=bad] | ||
| - | |||
| - | # Standard Un*x password updating. | ||
| - | |||
| - | @include common-password | ||
| - | |||
| - | **__ B. ftpconnect user __** | ||
| - | |||
| - | **** | ||
| - | |||
| - | There needs to be a user on the target machine that the can be used for ssh connections with the ssh keys | ||
| - | |||
| - | Sshfs relies on the user also having the same GID and UID | ||
| - | |||
| - | GID and UID may be set retrospectively using | ||
| - | |||
| - | | ||
| - | |||
| - | Or by assigning them at user creation | ||
| - | |||
| - | | ||
| - | |||
| - | The keys should be located in the usual place i.e. home/ | ||
| - | |||
| - | Ian Warburton | ||
| - | |||
| - | 8th Nov 2024 | ||
| - | |||
| - | |||
irax/dc_plus/ftp_service/start.1738341583.txt.gz · Last modified: 2025/01/31 16:39 by ian · Currently locked by: 10.32.1.188,216.73.216.148
