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

support password login #668

Merged
merged 2 commits into from
Nov 23, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ClusterBootstrap/template/RestfulAPI/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ default_memorylimit: {{cnf["default_memorylimit"]}}
enable_blobfuse: {{cnf["enable_blobfuse"]}}

local_fast_storage: {{cnf["local_fast_storage"]}}
user_sign_token: {{cnf["user_sign_token"]}}
12 changes: 12 additions & 0 deletions src/ClusterManager/job_launcher.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import datetime
import base64
import multiprocessing
import hashlib

from kubernetes import client, config as k8s_config
from kubernetes.client.rest import ApiException
Expand Down Expand Up @@ -523,6 +524,17 @@ def submit_job_impl(self, job):
job_object.params["uid"] = user_info["uid"]
job_object.params["user"] = job_object.get_alias()

if "job_token" not in job_object.params:
if "user_sign_token" in config and "userName" in job_object.params:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just want to make sure that this is an email, not just an alias.

Copy link
Member Author

Choose a reason for hiding this comment

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

it is email in the current implementation. maybe we need to force the format in portal or restfulapi

job_object.params["job_token"] = hashlib.md5(job_object.params["userName"]+":"+config["user_sign_token"]).hexdigest()
else:
job_object.params["job_token"] = "tryme2017"

if "envs" not in job_object.params:
job_object.params["envs"] =[]
job_object.params["envs"].append({"name": "DLTS_JOB_TOKEN", "value": job_object.params["job_token"]})


enable_custom_scheduler = job_object.is_custom_scheduler_enabled()
secret_template = job_object.get_blobfuse_secret_template()
if job_object.params["jobtrainingtype"] == "RegularJob":
Expand Down
2 changes: 1 addition & 1 deletion src/init-scripts/init_user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ time apt-get update && time apt-get install sudo openssl -y
# setup user and group, fix permissions
addgroup --force-badname --gid ${DLWS_GID} domainusers
adduser --force-badname --home /home/${DLWS_USER_NAME} --shell /bin/bash --uid ${DLWS_UID} -gecos '' --gid ${DLWS_GID} --disabled-password ${DLWS_USER_NAME}
usermod -p $(echo tryme2017 | openssl passwd -1 -stdin) ${DLWS_USER_NAME}
usermod -p $(echo ${DLTS_JOB_TOKEN} | openssl passwd -1 -stdin) ${DLWS_USER_NAME}
chown ${DLWS_USER_NAME} /home/${DLWS_USER_NAME}/ /home/${DLWS_USER_NAME}/.profile /home/${DLWS_USER_NAME}/.ssh || /bin/true
chmod 700 /home/${DLWS_USER_NAME}/.ssh || /bin/true

Expand Down