From cc81cc4d5d5526bbe971d777e539cebcc09232ba Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Tue, 4 May 2021 18:56:43 +0200 Subject: [PATCH] Add configuration management --- config/config.json.sample | 137 +++++++++++++++++++++++++++++ config/emails/changed_password.txt | 16 ++++ config/emails/event_error.txt | 19 ++++ config/emails/job_fail.txt | 36 ++++++++ config/emails/job_success.txt | 35 ++++++++ config/emails/recover_password.txt | 20 +++++ config/emails/welcome_new_user.txt | 12 +++ docker-compose.yml | 1 + 8 files changed, 276 insertions(+) create mode 100755 config/config.json.sample create mode 100755 config/emails/changed_password.txt create mode 100755 config/emails/event_error.txt create mode 100755 config/emails/job_fail.txt create mode 100755 config/emails/job_success.txt create mode 100755 config/emails/recover_password.txt create mode 100755 config/emails/welcome_new_user.txt diff --git a/config/config.json.sample b/config/config.json.sample new file mode 100755 index 0000000..160a8a6 --- /dev/null +++ b/config/config.json.sample @@ -0,0 +1,137 @@ +{ + "base_app_url": "http://localhost:3012", + "email_from": "admin@localhost", + "smtp_hostname": "localhost", + "smtp_port": 25, + "secret_key": "", + + "log_dir": "logs", + "log_filename": "[component].log", + "log_columns": ["hires_epoch", "date", "hostname", "pid", "component", "category", "code", "msg", "data"], + "log_archive_path": "logs/archives/[yyyy]/[mm]/[dd]/[filename]-[yyyy]-[mm]-[dd].log.gz", + "log_crashes": true, + "copy_job_logs_to": "", + "queue_dir": "queue", + "pid_file": "logs/cronicled.pid", + "debug_level": 9, + "maintenance": "04:00", + "list_row_max": 10000, + "job_data_expire_days": 180, + "child_kill_timeout": 10, + "dead_job_timeout": 120, + "master_ping_freq": 20, + "master_ping_timeout": 60, + "udp_broadcast_port": 3014, + "scheduler_startup_grace": 10, + "universal_web_hook": "", + "track_manual_jobs": false, + + "server_comm_use_hostnames": false, + "web_direct_connect": false, + "web_socket_use_hostnames": false, + + "job_memory_max": 1073741824, + "job_memory_sustain": 0, + "job_cpu_max": 0, + "job_cpu_sustain": 0, + "job_log_max_size": 0, + "job_env": {}, + + "web_hook_text_templates": { + "job_start": "Job started on [hostname]: [event_title] [job_details_url]", + "job_complete": "Job completed successfully on [hostname]: [event_title] [job_details_url]", + "job_failure": "Job failed on [hostname]: [event_title]: Error [code]: [description] [job_details_url]", + "job_launch_failure": "Failed to launch scheduled event: [event_title]: [description] [edit_event_url]" + }, + + "client": { + "name": "Cronicle", + "debug": 1, + "default_password_type": "password", + "privilege_list": [ + { "id": "admin", "title": "Administrator" }, + { "id": "create_events", "title": "Create Events" }, + { "id": "edit_events", "title": "Edit Events" }, + { "id": "delete_events", "title": "Delete Events" }, + { "id": "run_events", "title": "Run Events" }, + { "id": "abort_events", "title": "Abort Events" }, + { "id": "state_update", "title": "Toggle Scheduler" } + ], + "new_event_template": { + "enabled": 1, + "params": {}, + "timing": { "minutes": [0] }, + "max_children": 1, + "timeout": 3600, + "catch_up": 0, + "queue_max": 1000 + } + }, + + "Storage": { + "engine": "Filesystem", + "list_page_size": 50, + "concurrency": 4, + "log_event_types": { "get": 1, "put": 1, "head": 1, "delete": 1, "expire_set": 1 }, + + "Filesystem": { + "base_dir": "data", + "key_namespaces": 1 + } + }, + + "WebServer": { + "http_port": 3012, + "http_htdocs_dir": "htdocs", + "http_max_upload_size": 104857600, + "http_static_ttl": 3600, + "http_static_index": "index.html", + "http_server_signature": "Cronicle 1.0", + "http_gzip_text": true, + "http_timeout": 30, + "http_regex_json": "(text|javascript|js|json)", + "http_response_headers": { + "Access-Control-Allow-Origin": "*" + }, + + "https": false, + "https_port": 3013, + "https_cert_file": "conf/ssl.crt", + "https_key_file": "conf/ssl.key", + "https_force": false, + "https_timeout": 30, + "https_header_detect": { + "Front-End-Https": "^on$", + "X-Url-Scheme": "^https$", + "X-Forwarded-Protocol": "^https$", + "X-Forwarded-Proto": "^https$", + "X-Forwarded-Ssl": "^on$" + } + }, + + "User": { + "session_expire_days": 30, + "max_failed_logins_per_hour": 5, + "max_forgot_passwords_per_hour": 3, + "free_accounts": false, + "sort_global_users": true, + "use_bcrypt": true, + + "email_templates": { + "welcome_new_user": "conf/emails/welcome_new_user.txt", + "changed_password": "conf/emails/changed_password.txt", + "recover_password": "conf/emails/recover_password.txt" + }, + + "default_privileges": { + "admin": 0, + "create_events": 1, + "edit_events": 1, + "delete_events": 1, + "run_events": 0, + "abort_events": 0, + "state_update": 0 + } + } + +} diff --git a/config/emails/changed_password.txt b/config/emails/changed_password.txt new file mode 100755 index 0000000..fc4beb8 --- /dev/null +++ b/config/emails/changed_password.txt @@ -0,0 +1,16 @@ +To: [/user/email] +From: [/config/email_from] +Subject: Your Cronicle password was changed + +Hey [/user/full_name], + +Someone recently changed the password on your Cronicle account. If this was you, then all is well, and you can disregard this message. However, if you suspect your account is being hacked, you might want to consider using the "Forgot Password" feature (located on the login page) to reset your password. + +Here is the information we gathered from the request: + +Date/Time: [/date_time] +IP Address: [/ip] +User Agent: [/request/headers/user-agent] + +Regards, +The Cronicle Team diff --git a/config/emails/event_error.txt b/config/emails/event_error.txt new file mode 100755 index 0000000..c53c830 --- /dev/null +++ b/config/emails/event_error.txt @@ -0,0 +1,19 @@ +To: [/notify_fail] +From: [/config/email_from] +Subject: ⚠️ Cronicle Event Error: [/title] + +Date/Time: [/nice_date_time] +Event Title: [/title] +Hostname: [/hostname] + +Error Description: +[/description] + +Edit Event: +[/edit_event_url] + +Event Notes: +[/notes] + +Regards, +The Cronicle Team diff --git a/config/emails/job_fail.txt b/config/emails/job_fail.txt new file mode 100755 index 0000000..b0aa7e4 --- /dev/null +++ b/config/emails/job_fail.txt @@ -0,0 +1,36 @@ +To: [/notify_fail] +From: [/config/email_from] +Subject: ⚠️ Cronicle Job Failed: [/event_title] + +Date/Time: [/nice_date_time] +Event Title: [/event_title] +Category: [/category_title] +Server Target: [/nice_target] +Plugin: [/plugin_title] + +Job ID: [/id] +Hostname: [/hostname] +PID: [/pid] +Elapsed Time: [/nice_elapsed] +Performance Metrics: [/perf] +Avg. Memory Usage: [/nice_mem] +Avg. CPU Usage: [/nice_cpu] +Error Code: [/code] + +Error Description: +[/description] + +Job Details: +[/job_details_url] + +Job Debug Log ([/nice_log_size]): +[/job_log_url] + +Edit Event: +[/edit_event_url] + +Event Notes: +[/notes] + +Regards, +The Cronicle Team diff --git a/config/emails/job_success.txt b/config/emails/job_success.txt new file mode 100755 index 0000000..6732696 --- /dev/null +++ b/config/emails/job_success.txt @@ -0,0 +1,35 @@ +To: [/notify_success] +From: [/config/email_from] +Subject: ✅ Cronicle Job Completed Successfully: [/event_title] + +Date/Time: [/nice_date_time] +Event Title: [/event_title] +Category: [/category_title] +Server Target: [/nice_target] +Plugin: [/plugin_title] + +Job ID: [/id] +Hostname: [/hostname] +PID: [/pid] +Elapsed Time: [/nice_elapsed] +Performance Metrics: [/perf] +Avg. Memory Usage: [/nice_mem] +Avg. CPU Usage: [/nice_cpu] + +Job Details: +[/job_details_url] + +Job Debug Log ([/nice_log_size]): +[/job_log_url] + +Edit Event: +[/edit_event_url] + +Description: +[/description] + +Event Notes: +[/notes] + +Regards, +The Cronicle Team diff --git a/config/emails/recover_password.txt b/config/emails/recover_password.txt new file mode 100755 index 0000000..5dd5128 --- /dev/null +++ b/config/emails/recover_password.txt @@ -0,0 +1,20 @@ +To: [/user/email] +From: [/config/email_from] +Subject: Forgot your Cronicle password? + +Hey [/user/full_name], + +Someone recently requested to have your password reset on your Cronicle account. To make sure this is really you, this confirmation was sent to the e-mail address we have on file for your account. If you really want to reset your password, please click the link below. If you cannot click the link, copy and paste it into your browser. + +[/self_url]#Login?u=[/user/username]&h=[/recovery_key] + +This password reset page will expire after 24 hours. + +If you suspect someone is trying to hack your account, here is the information we gathered from the request: + +Date/Time: [/date_time] +IP Address: [/ip] +User Agent: [/request/headers/user-agent] + +Regards, +The Cronicle Team diff --git a/config/emails/welcome_new_user.txt b/config/emails/welcome_new_user.txt new file mode 100755 index 0000000..1984ced --- /dev/null +++ b/config/emails/welcome_new_user.txt @@ -0,0 +1,12 @@ +To: [/user/email] +From: [/config/email_from] +Subject: Welcome to Cronicle! + +Hey [/user/full_name], + +Welcome to Cronicle! Your new account username is "[/user/username]". You can login to your new account by clicking the following link, or copying & pasting it into your browser: + +[/self_url] + +Regards, +The Cronicle Team diff --git a/docker-compose.yml b/docker-compose.yml index f69837f..55c9f86 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,3 +18,4 @@ services: volumes: - ./data:/opt/cronicle/data:rw - ./logs:/opt/cronicle/logs:rw + - ./config:/opt/cronicle/conf:rw