Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the caller ip into rsync hosts allow list #51004

Merged
merged 1 commit into from
Sep 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/build-image/rsyncd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ port = 8730
numeric ids = true
$USER_CONFIG
hosts deny = *
hosts allow = ${ALLOW}
hosts allow = ${ALLOW} ${ALLOW_HOST-}
auth users = k8s
secrets file = ${SECRETS}
read only = false
Expand Down
1 change: 1 addition & 0 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ function kube::build::start_rsyncd_container() {
V=3 kube::log::status "Starting rsyncd container"
kube::build::run_build_command_ex \
"${KUBE_RSYNC_CONTAINER_NAME}" -p 127.0.0.1:${KUBE_RSYNC_PORT}:${KUBE_CONTAINER_RSYNC_PORT} -d \
-e ALLOW_HOST="$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any simpler way to list IPs on the machine? this is pretty difficult to understand as written.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On linux hosts, hostname --ip-address can tell the host IP address in a neat way, however, it does not work on Mac as far as I can tell, so I think the grep way is the only cross-platform approach I can think about..

Or do you prefer:

  1. check the OS type.
  2. use hostname --ip-address when it is linux.

-- /rsyncd.sh >/dev/null

local mapped_port
Expand Down