eltex-nginx
Комментируем директивы listen с IPv6-адресами (пример: listen [::]:8080 ) в конфиге softwlc.conf
server {
listen 8080;
# listen [::]:8080;...}
eltex-radius
Комментируем директивы listen с IPv6-адресами в /etc/eltex-radius/servers/default
Создаем файл ./data/eltex-radius/etc/eltex-radius/servers/default
sudo mkdir -p ./data/eltex-radius/etc/eltex-radius/servers/
sudo touch ./data/eltex-radius/etc/eltex-radius/servers/default
sudo chown -R root:root ./data/eltex-radius/etc/eltex-radius/servers
sudo chmod 644 ./data/eltex-radius/etc/eltex-radius/servers/default
Ниже приведена конфигурация servers/default с закомментированным блоком listen, в котором присутствует ipv6addr = ::
Копируем текст конфигурации в созданный файл ./data/eltex-radius/etc/eltex-radius/servers/default
server default {
authorize {
# Preprocess request attributes
#filter_username
common_ciscoavpair
rewrite_called_station_id
preprocess
proxy_auth
proxy_ssid
chap
mschap
# check for ubiquity vendor group
if (${vendor_group_enabled} == 1) {
vendor_group
}
if (&Eltex-Tls-Enabled && &Eltex-Tls-Enabled == 1) {
if (&Eltex-Tls-Required && &Eltex-Tls-Required == 1) {
update control {
EAP-Type := TLS
}
}
eap-tls
}
elsif (&control:Eltex-Vendor-Group && &control:Eltex-Vendor-Group == "ubi") {
eap-ubi
}
else {
eap
}
if (ok) {
return
}
# User is Authenticated with MAC through SoftWLC Portal on the side of PCRF
if (&Eltex-Portal-Authentication && &Eltex-Portal-Authentication == 1) {
update control {
Auth-Type := Accept
}
if (&User-Name) {
update reply {
# Include real username to switch from MAC
User-Name := "%{User-Name}"
}
}
}
# check Sim-Use at mongo pcrf.session
if (${pcrf_enabled} == 1) {
pcrf
}
update request {
# Save current time in request to compare with user attribute in database
Eltex-User-Expires = "%l"
Eltex-User-Deactivation-Expires = "%l"
}
sql
if (noop) {
# User's check items are not matched
reject
}
if (notfound) {
# User not found in database
reject
}
#
# If no other module has claimed responsibility for
# authentication, then try to use PAP. This allows the
# other modules listed above to add a "known good" password
# to the request, and to do nothing else. The PAP module
# will then see that password, and use it to do PAP
# authentication.
#
# This module should be listed last, so that the other modules
# get a chance to set Auth-Type for themselves.
#
pap
Autz-Type Status-Server {
# EAP module adds server certificate expiration date to response
eap
eap-tls
# Respond with Access-Accept
ok
}
}
authenticate {
Auth-Type PAP {
pap
}
Auth-Type CHAP {
chap
}
Auth-Type MS-CHAP {
mschap
}
Auth-Type eap-tls {
eap-tls
update control {
TLS-Client-Cert-Serial := "%{sql:SELECT value FROM radcheck WHERE username='%{User-Name}' AND domain=REVERSE('%{Eltex-Domain}') AND attribute='TLS-Client-Cert-Serial';}"
}
if (&request:TLS-Client-Cert-Serial && &control:TLS-Client-Cert-Serial) {
if (&request:TLS-Client-Cert-Serial != &control:TLS-Client-Cert-Serial) {
reject
}
}
}
eap-ubi
eap
}
preacct {
preprocess
acct_counters64
acct_unique
acct_ciscoavpair
# Parse common cisco-avp ('domain' for example)
common_ciscoavpair
rewrite_called_station_id
if (${pcrf_enabled} == 0) {
fill_ap_domain
}
files
}
accounting {
if (${pcrf_enabled} == 1) {
# All accounting is handled by pcrf. So we do nothing.
noop
} else {
if (Acct-Status-Type == "Stop") {
update_quota
}
}
sql
attr_filter.accounting_response
#
# See "Autz-Type Status-Server" for how this works.
#
# Acct-Type Status-Server {
#
# }
}
# Session database, used for checking Simultaneous-Use.
session {
if (${pcrf_enabled} == 0) {
sql
}
}
post-auth {
if (${pcrf_enabled} == 1) {
pcrf
}
# sql
#
# For EAP-TTLS and PEAP, add the cached attributes to the reply.
# The "session-state" attributes are automatically cached when
# an Access-Challenge is sent, and automatically retrieved
# when an Access-Request is received.
#
# The session-state attributes are automatically deleted after
# an Access-Reject or Access-Accept is sent.
#
update {
&reply: += &session-state:
}
update reply {
Eltex-Simultaneous-Use := "%{Simultaneous-Use}"
}
# Remove reply message if the response contains an EAP-Message
remove_reply_message_if_eap
#
Post-Auth-Type REJECT {
if (${pcrf_enabled} == 1) {
pcrf
}
# sql
attr_filter.access_reject
# Insert EAP-Failure message if the request was
# rejected by policy instead of because of an
# authentication failure
eap
# Remove reply message if the response contains an EAP-Message
remove_reply_message_if_eap
}
fill_vendor_attrs
}
pre-proxy {
}
post-proxy {
# Post-Proxy-Type Fail-Accounting {
# detail
# }
}
listen {
type = auth
ipaddr = *
port = ${auth_port}
limit {
max_connections = 16
lifetime = 0
idle_timeout = 30
}
}
#listen {
# type = auth
# ipv6addr = ::
# port = ${auth_port}
# limit {
# max_connections = 16
# lifetime = 0
# idle_timeout = 30
# }
#}
# Uncomment this sections when pcrf_enabled=0
# listen {
# ipaddr = *
# port = ${acct_port}
# type = acct
# }
#
# listen {
# ipv6addr = ::
# port = ${acct_port}
# type = acct
# }
}
Монтируем файл ./data/eltex-radius/etc/eltex-radius/servers/default в докер контейнер eltex-radius.
eltex-radius:
container_name: eltex-radius
..
volumes:
..
# Disable IPv6
- ./data/eltex-radius/etc/eltex-radius/servers/default:/etc/eltex-radius/servers/default:ro
eltex-ems-vsftpd
Для отключения IPv6 в vsftpd нужно в конфиге установить взаимоисключающие параметры listen_ipv6=NO, listen=YES
Создаем файл ./data/eltex-ems-vsftpd/etc/vsftpd.conf
sudo mkdir -p ./data/eltex-ems-vsftpd/etc/
sudo touch ./data/eltex-ems-vsftpd/etc/vsftpd.conf
sudo chown -R root:root ./data/eltex-ems-vsftpd/etc
sudo chmod 644 ./data/eltex-ems-vsftpd/etc/vsftpd.conf
Ниже приведена конфигурация vsftpd.conf с закомментированным блоком listen, в котором присутствует ipv6addr = ::
Копируем текст конфигурации в созданный файл ./data/eltex-radius/etc/eltex-radius/servers/default
# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone? vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
listen_ipv6=NO
#
# Allow anonymous FTP? (Disabled by default).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=NO
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# If enabled, vsftpd will display directory listings with the time
# in your local time zone. The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may restrict local users to their home directories. See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
#chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# Customization
#
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# This option should be the name of a directory which is empty. Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
# uncomments
# Uncomment this to indicate that vsftpd use a utf8 filesystem.
#utf8_filesystem=YES
local_root=/srv/
Монтируем файл ./data/eltex-ems-vsftpd/etc/vsftpd.conf в докер контейнер eltex-ems-vsftpd.
eltex-ems-vsftpd:
container_name: eltex-ems-vsftpd
...
volumes:
# Disable IPv6
- ./data/eltex-ems-vsftpd/etc/vsftpd.conf:/etc/vsftpd.conf:ro
eltex-ems-tftpd
Для отключения IPv6 в tftpd нужно подать дополнительный флаг --ipv4
В docker-compose.yml переопределяем CMD для запуска контейнера eltex-ems-tftpd
eltex-ems-tftpd:
container_name: eltex-ems-tftpd
..
# Disable IPv6
command: ["/usr/sbin/in.tftpd", "--foreground", "--secure", "--create", "--user", "tftpd", "/data", "--ipv4"]
Пересоздание docker-контейнеров
В конце всех действий по отключению поддержки IPv6 нужно пересоздать и переконфигурировать докер контейнеры.
Это можно сделать командой:
# Параметры emsip, serverip нужно указывать свои
sudo ./eltex-softwlc-helper-docker-latest.sh --delete-containers --run --configure --emsip 192.168.0.100 --serverip 192.168.0.100