-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from riddhi-ibm/enable_nfs_over_tls
Experimental testing NFS using TLS for specific OS versions
- Loading branch information
Showing
6 changed files
with
304 additions
and
7 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
mount-helper/certs/dev/metadata/type_ibmshare_root_dal_preprod_tls.crt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIFljCCBH6gAwIBAgIUNX3isp/i5hTNhwd/aVz1gXz2aqUwDQYJKoZIhvcNAQEL | ||
BQAwbDELMAkGA1UEBhMCVVMxDjAMBgNVBAgTBVRleGFzMRIwEAYDVQQKEwlJQk0g | ||
Q2xvdWQxFDASBgNVBAsTC1ZQQyBTdG9yYWdlMSMwIQYDVQQDExpjbG91ZC5pYm0u | ||
dnBjLnN0b3JhZ2UuZmlsZTAeFw0yNDA5MDYxMTE2NDZaFw0zNDA5MDQxMTE3MTVa | ||
MGwxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIEwVUZXhhczESMBAGA1UEChMJSUJNIENs | ||
b3VkMRQwEgYDVQQLEwtWUEMgU3RvcmFnZTEjMCEGA1UEAxMaY2xvdWQuaWJtLnZw | ||
Yy5zdG9yYWdlLmZpbGUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDb | ||
yA91DDfESBnG06C5velPGty2ZR2ookqWom/5ZG6694bAo5y7D/sSsX4H7VR2DBvT | ||
yDrfWq9TgvhcNbYPCPjX+P5FMGd0FWOm7vxv+HvLQNjsV8nsEE9qAovxigV5zghX | ||
WzE0C3DpGCPFZT3XMmp6hKFPzdNtAltESruIGcyp68my7WZ+D4u1CC0P4zJK0+PF | ||
/K7r3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RyK1/VoQ5bQcUD20Ck99qInOVASF7lOv14+KRaeFe7Dq0NnxWAPGYh9mkfp1 | ||
KgFRxg/9Oy/phMbWRYtrK3dD9DPKBwILSZ57Wmewjdpfy0ghZ/+4dgH24Sx29qVY | ||
rRm4yaH7Kvw0/MF9soEQotLpUQ4lDKrSh8aR | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) IBM Corp. 2024. All Rights Reserved. | ||
# Project name: VPC File Storage Mount Helper | ||
# This project is licensed under the MIT License, see LICENSE file in the root directory. | ||
|
||
FILE_PATH="/etc/hosts" | ||
ip_address=$1 | ||
|
||
# Function to validate IP address format | ||
is_valid_ip() { | ||
local ip=$1 | ||
local valid_ip_regex="^([0-9]{1,3}\.){3}[0-9]{1,3}$" | ||
|
||
if [[ $ip =~ $valid_ip_regex ]]; then | ||
IFS='.' read -r -a octets <<< "$ip" | ||
for octet in "${octets[@]}"; do | ||
if (( octet < 0 || octet > 255 )); then | ||
echo "Invalid IP address format." | ||
return 1 # Invalid octet | ||
fi | ||
done | ||
|
||
# Check for special IP addresses | ||
if [[ $ip == "0.0.0.0" ]] || | ||
[[ $ip == "255.255.255.255" ]]; then | ||
echo "Special IPs not allowed." | ||
return 1 # Special IP addresses are considered invalid for this context | ||
fi | ||
|
||
return 0 # Valid public IP address | ||
else | ||
return 1 # Invalid format | ||
fi | ||
} | ||
|
||
# Function to validate hostname extension | ||
is_valid_host_extension() { | ||
local hostname=$1 | ||
if [[ $hostname == *.ibm.vpc.file.storage ]]; then | ||
return 0 | ||
else | ||
echo "The hostname does NOT have the correct extension." | ||
return 1 | ||
fi | ||
} | ||
|
||
# Main logic | ||
if is_valid_ip "$ip_address" || is_valid_host_extension "$ip_address"; then | ||
if grep -q "$ip_address" "$FILE_PATH"; then | ||
grep "$ip_address" "$FILE_PATH" | awk '{print $2}' | ||
else | ||
echo "$ip_address ibmshare_${ip_address//./_}.ibm.vpc.file.storage" | tee -a "$FILE_PATH" | ||
fi | ||
else | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.