当前位置:网站首页>Olivetin can safely run shell commands on Web pages (Part 1)
Olivetin can safely run shell commands on Web pages (Part 1)
2022-07-06 17:51:00 【Yangpu Laosu】

I suddenly received a notice from the neighborhood committee yesterday afternoon , evening 7 Spot full screening . It seems that there should be another one in these two days

Net friend
figoask :Is there any software or docker One key shutdown and one key restart Linux host ? Instead of opening the command line to execute the command ., Old Su thought of lying in the plan list for a long time at the first timeOliveTin, The reason why I didn't move was because I didn't think about what to do . I didn't find it until I really began to toss ,OliveTinMore problems than expected , Even the official examples can encounter pits , It may be becausedockerThe way isSynologyFor running on , On the contrary, it aroused Lao Su's interest .
What is? OliveTin ?
OliveTinCan let you fromWebThe interface safely and simply accesses predefinedshellcommand .

Get ready
First of all, prepare for config.yaml file , The simplest is, of course, to copy the official sample document , You can copy and paste , You can also save it as .https://raw.githubusercontent.com/OliveTin/OliveTin/main/config.yaml
Action
A standard action ( We can understand it as a button ) There are several parts :
title: title , This is required , Used to identifyaction;shell: Script , It's also required , To perform specific tasks ;icon: Icon , This is not necessary , But some words will look more comfortable , Except for the pictures , And support https://unicode-table.com/en/emoji/ Ofemoji;arguments: Parameters , This is not necessary , Can be used to implement some variables , Give WayshellHave some flexibility ;timeout: Overtime , This is also unnecessary ;
So in general , A button just title and shell That's all right. , Take the simplest complete config.yaml Example
# Listening port
listenAddressSingleHTTPFrontend: 0.0.0.0:1337
# The level of logging :INFO (default), WARN and DEBUG
logLevel: "INFO"
# Show new version
showNewVersions: true
# Actions (buttons) to show up on the WebUI:
actions:
# Start with the simplest
- title: function echo
icon: "📝"
shell: echo " I'm old su ."
You can also use this as config.yaml, Let the container run first and then modify 、 Perfect and enrich functions .
install
On the group light with Docker Way to install .
Search the registry for olivetin , Select first jamesread/olivetin, Version selection latest.

Container name
Because you need to enter the container through the command line later , It is recommended to change the name of the container to olivetin, Of course, this is not necessary , You can also directly change the container name in the command line

volume
stay docker In the folder , Create a new folder olivetin
| Folder | Loading path | explain |
|---|---|---|
docker/olivetin | /config | Storage settings |
Suggest to check
read-only

port
The local port does not conflict , If you're not sure, you can use the command to check
# Check port usage
netstat -tunlp | grep Port number
| Local port | Container port |
|---|---|
1337 | 1337 |

Command line installation
If you are familiar with the command line , Possible docker cli Faster
# New folder kavita and subdirectories
mkdir -p /volume2/docker/olivetin
# Get into kavita Catalog
cd /volume2/docker/olivetin
# Upload config.yaml File to the current directory
# Run container
docker run -d \
--restart unless-stopped \
--name olivetin \
-p 1337:1337 \
-v $(pwd):/config:ro \
jamesread/olivetin
It can also be used. docker-compose install , The following is the official docker-compose.yml, Pay attention to modifying the path
version: "3.8"
services:
olivetin:
container_name: olivetin
image: jamesread/olivetin
volumes:
- ./:/config # replace host path or volume as needed
ports:
- "1337:1337"
restart: unless-stopped
networks:
web:
section:
external: true
Then execute the following command , Because the relative path is adopted , stay portainer It is also possible to execute in
# New folder kavita and subdirectories
mkdir -p /volume2/docker/olivetin
# Get into kavita Catalog
cd /volume2/docker/olivetin
# take docker-compose.yml and config.yaml Put in the current directory
# One button start
docker-compose up -d
function
Enter... In the browser http:// Synology IP:1337 You can see the main interface
This is the official
config.yamlThe interface of

If you use Lao Su's minimization example , There is only one button , We click function echo Button

Will be displayed [Success]

Detailed information can be found in the upper right corner Logs View in

remaining problems
problem 1: jurisdiction
There's an official ping An example of , Considering that you can't visit at home google, So Lao Su changed the target address to baidu
actions:
# This sends 1 ping to baidu.com.
- title: ping baidu.com
shell: ping baidu.com -c 4
icon: ping
timeout: 3
By default , You will meet ping: usage error: Destination address required
And if you will shell Change it to sudo ping baidu.com -c 1 when , You will need to enter password for olivetin, So the only way is docker cli The next execution container is added --user=root perhaps --privileged
# use root Run container
docker run -d \
--restart unless-stopped \
--name olivetin \
--user=root \
-p 1337:1337 \
-v $(pwd):/config:ro \
jamesread/olivetin
problem 2:ssh password
The government also provided ssh An example of , Lao Su made adjustments
sshThe identity of the login host can berootOr any other authorized account , It's just for demonstration , Generally, it is not recommended to use it directlyroot
actions:
- title: Log in to ds3617xs ping Baidu
shell: ssh [email protected] 'ping baidu.com -c 4'
icon: "📌"
timeout: 50
perform ssh It doesn't need to root jurisdiction , But because you can't enter the password directly on the command line , So it will lead to timeout

perhaps Exit code 255

The official idea is to use SSH Key setting no password login , But old Su thought this way was not flexible .
Lao Su thought of a kind of flexible , But a relatively safe solution , Coming soon ~
Friday , Be there or be square !
Reference documents
OliveTin/OliveTin: OliveTin gives safe and simple access to predefined shell commands from a web interface.
Address :https://github.com/OliveTin/OliveTin
OliveTin - give safe and simple access to predefined shell commands from a web interface
Address :https://www.olivetin.app/
OliveTin documentation
Address :https://docs.olivetin.app/
List of common exit codes for GNU/Linux
Address :https://slg.ddnss.de/list-of-common-exit-codes-for-gnu-linux/
边栏推荐
- Error: Publish of Process project to Orchestrator failed. The operation has timed out.
- EasyCVR授权到期页面无法登录,该如何解决?
- Xin'an Second Edition: Chapter 24 industrial control safety demand analysis and safety protection engineering learning notes
- Summary of Android interview questions of Dachang in 2022 (II) (including answers)
- [ASM] introduction and use of bytecode operation classwriter class
- EasyCVR电子地图中设备播放器loading样式的居中对齐优化
- 编译原理——预测表C语言实现
- The solution that flutterweb browser cannot be rolled back after refreshing
- Distinguish between basic disk and dynamic disk RAID disk redundant array
- Flet教程之 13 ListView最常用的滚动控件 基础入门(教程含源码)
猜你喜欢

Unity particle special effects series - treasure chest of shining stars

Chrome prompts the solution of "your company management" (the startup page is bound to the company's official website and cannot be modified)

面试突击62:group by 有哪些注意事项?

kivy教程之在 Kivy 中支持中文以构建跨平台应用程序(教程含源码)

李書福為何要親自掛帥造手機?

The problem of "syntax error" when uipath executes insert statement is solved

Grafana 9 正式发布,更易用,更酷炫了!

The solution that flutterweb browser cannot be rolled back after refreshing
![[rapid environment construction] openharmony 10 minute tutorial (cub pie)](/img/b5/feb9c56a65c3b07403710e23078a6f.jpg)
[rapid environment construction] openharmony 10 minute tutorial (cub pie)

C语言通过指针交换两个数
随机推荐
分布式(一致性协议)之领导人选举( DotNext.Net.Cluster 实现Raft 选举 )
Pytest learning ----- pytest operation mode and pre post packaging of interface automation testing
Basic configuration and use of spark
Start job: operation returned an invalid status code 'badrequst' or 'forbidden‘
Kernel link script parsing
The easycvr platform reports an error "ID cannot be empty" through the interface editing channel. What is the reason?
李书福为何要亲自挂帅造手机?
Xin'an Second Edition: Chapter 12 network security audit technology principle and application learning notes
C语言指针*p++、*(p++)、*++p、*(++p)、(*p)++、++(*p)对比实例
Pyspark operator processing spatial data full parsing (5): how to use spatial operation interface in pyspark
The shell generates JSON arrays and inserts them into the database
Mysqlimport imports data files into the database
C语言通过指针交换两个数
Smart street lamp based on stm32+ Huawei cloud IOT design
Summary of study notes for 2022 soft exam information security engineer preparation
In terms of byte measurement with an annual salary of 30W, automated testing can be learned in this way
Flet教程之 13 ListView最常用的滚动控件 基础入门(教程含源码)
Yarn: unable to load file d:\programfiles\nodejs\yarn PS1, because running scripts is prohibited on this system
Appium automated test scroll and drag_ and_ Drop slides according to element position
一体化实时 HTAP 数据库 StoneDB,如何替换 MySQL 并实现近百倍性能提升